3
How can I pass this code on JavaScript
for jQuery
? I didn’t understand the context...
document.getElementById("imageForm").target = "my_iframe";
3
How can I pass this code on JavaScript
for jQuery
? I didn’t understand the context...
document.getElementById("imageForm").target = "my_iframe";
4
You don’t have to change that to jQuery. Of course you can change but remember that jQuery is Javascript and will only cause the same code to run at the end. That is, jQuery will run exactly that code at the end, but go through more code before and get slower. If it’s not necessary, don’t use jQuery.
The context here is in case you have an iframe on the page you want an anchor to open on that iframe instead of opening on the same page. The value you give to that target
has to match the property name
iframe.
If you want to do it in jQuery, you can do it like this:
$('#imageForm').attr('target', 'my_iframe');
Example of the context:
document.getElementById("minha_iframe").target = "minha_iframe";
<iframe src="" id="minha_iframe" name="minha_iframe"></iframe>
<a href="http://cnn.com" target="minha_iframe">Abrir o link na iFrame</a>
Browser other questions tagged javascript jquery
You are not signed in. Login or sign up in order to post.
I think the context is to change the target of a form from the main window to the iframe.
– bfavaretto