Jquery: How To Modify Loaded Content From Inside Load Callback
I'm dynamically creating a number of div elements (rows). Every row will have the same basic format, only text changes. As the row structure is complex, I'm trying to load a 'basic
Solution 1:
You are referencing the DOM element which contains functions but is not a function.
You can't use $div()
, you need to use the object's function .find()
in your case to find the element with the attribute data-custom-role=name
Try :
functionloadRow(params, div){
var$div = $(div);
$div.load("some_page.html [data-custom-role=row]", function(){
$div.find("[data-custom-role=name]").html(params.name);
});
}
Post a Comment for "Jquery: How To Modify Loaded Content From Inside Load Callback"