Tony Borf
Tony Borf

Reputation: 4660

Jquery and iFrame update

I want to create a page that has a dropdown and an iframe, so that the iframe location will change based on the url in the dropdown. What is the correct syntax to get jquery to update the iframe's url?

thanks

Upvotes: 0

Views: 6254

Answers (2)

Mark Bell
Mark Bell

Reputation: 29785

I think this will work:

$('#dropdownid').bind('change', function() {
    $('#iframeid').attr('src', $(this).val());
});

Upvotes: 3

Jeff Ober
Jeff Ober

Reputation: 5027

To change an iframe's url, you update its src attribute.

Upvotes: 1

Related Questions