retro-starr Posted December 29, 2010 Share Posted December 29, 2010 Below I made a function that I feel should've updated the input field "url_input" with the value of the new src. This does not work though, so my question is what am I doing wrong? function iframe_address() { $('#content["src"]').change(function() { $('#url_input').attr('value', change()); }); }; #content being the iframesrc is the attribute I want to watch#input_input being the input fieldvalue being the attribute I want to update Link to comment Share on other sites More sharing options...
retro-starr Posted December 30, 2010 Author Share Posted December 30, 2010 Just found out that JS/JQuery change() only works for input, select, and text areas not iframe; so I figure I'd have to do load() instead.This seems like it'd work, but I need someone more versed in JQuery to aid me on this. $('#content').load(function() { var x = $('#content[src]'); $('#url_input').attr('value', x); }); Link to comment Share on other sites More sharing options...
retro-starr Posted December 30, 2010 Author Share Posted December 30, 2010 I got it! Only problem is that it's not aware of links from inside the iframe, so it doesn't update the src, but instead the contents of the iframe.I was close: $('#content').load(function() { var x = $('#content').attr('src'); $('#url_input').attr('value', x); }); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.