Sunday, June 12, 2016

javascript - Will this construct work all time

On my site it will have product tiles, each tile will have a button in it, tiles will be loaded by ajax call according to availability, i am using following function to initialize function with the div's. Here "add_+uid" is the id for the button



$('#add_'+uid).bind("click",addFunction);
function addFunction(){


...
}


I found that the code above will work only on page load,
Can i use it like and is this a solution for ajax type scenario?



$('#add_'+uid).click(addFunction);



If this will not work any suggestion about this scenario?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...