finding all iframe srcs with jquery

$(document).ready(function() {
    $('#somebuttonid').click(function() {
        $("iframe").each(function() {
            var src = $(this).attr('src');
            $(this).attr('src', src);  
        });

    });
});

You can refresh all the iframe like this

$("iframe").each(function() { 
   $(this).attr('src', $(this).attr('src')); 
});

You can pass a function to .attr() [docs] (or .prop() [docs]):

$('iframe').attr('src', function(index, val) {
    return val;
});

This function is executed for each element. It's a bit more concise than using an explicit .each loop.

Tags:

Jquery