On my blog, I'm using a script that reveals anonymous messages as their normal username instead of anonymous. The script works fine on pages that I can make, but on pages that are default generated by my host (such as /ask, containing a message box which I cannot edit), I can't edit the code for the ask box so therefore it won't work. If anyone could provide a jQuery code that will
- Change the iFrame SRC with an ID of #askbox from "http://www.tumblr.com/ask_form/jamescharless.com" to "http://jamescharless.com/askbox"
- Remove the ID from the iFrame so it simply doesn't have an id
If anyone could help me it would be EXTREMELY helpful.
This should change your IFrame src
$("#askbox").attr("src", "http://jamescharless.com/askbox");
You could try:
$("#askbox").removeAttr("id");
Combine the two:
$("#askbox").attr("src", "http://jamescharless.com/askbox").removeAttr("id");
Trying to solve your scripting problem...
Opening the page in a debugger you can run:
document.getElementById('wrapper');
but not
document.getElementById('ask_form') - it throws an error
Plan B
How about injecting a fresh IFrame?
$('#ask_form').parent().html('<iframe width="100%" height="149"
src="http://jamescharless.com/askbox" frameBorder="0"
scrolling="no" style="overflow: hidden; background-color: transparent;">
</iframe>');
$(document).ready(function(){
$('#askbox').attr("src", "http://jamescharless.com/askbox");
$('#askbox').removeAttr("id");
});