I think this question is better served with an example. I have the following code:
$.get(开发者_JAVA技巧'path/'+id,function(data){
$('#mydiv').html(data); $('.editable').button().click(function(){ //process here }); });
And it works just fine; however, I think it would be more optimal to only go through "mydiv" when I call $('.editable') rather than through the whole page without even finding "mydiv" again. Example of what I think should work:
$('#mydiv').html(data).$('.editable').button().click(function(){
//process here }); });
In other words, I suppose after completing its work with the html function I can perform another action on this div. Is this possible? Sorry if this seems odd and convoluted.
Thanks!
var my_div = $('#mydiv');
$.get('path/'+id,function(data){
my_div.html(data)
.find('.editable')
.button()
.click(function(){
//process here
});
});
精彩评论