JQuery .each Against a Variable -


how 1 specify target variable jquery each function? performing request , placing results in variable. want run each function on variable pull out id tags. many thanks.

$.get("somepage.php?id=45 #my_target_div", function(data) {    $.each(function(data, "#id") {    }); }); 

the $.get() method doesn't allow filter down results selector .load() does, , use of .each() wrong.

this allow loop through elements have id attribute inside my_target_div.

$.get("somepage.php?id=45", function(data) {        $("<div />").html(data).find("#my_target_div [id]").each(function(){        // annoying alert        alert(this.id);        // or more appealing console log        // console.log(this.id);    }); }); 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -