I know that in deleate i need first to get the context selector like:
$("#Mydiv").delegate(...
But what if i even dont have $(“#Mydiv”) ?
What if $("#Mydiv") should come from the server in future time ?
If i put it Now on the page , will it work in the future when $(“#Mydiv”) will come in ajax from ther server ?
What you want is
$("#MyDiv").live('click', function() {}).Live works by binding all events to the document element, so that events are handled after they bubble up through the DOM. Under the hood,
.live()is really just calling$(document).delegate("#MyDiv", 'click', function() {}).