Hello,
what happens if the element I am binding jQuery code to is not found on the page? Does the previous binded code breaks?
Let me explain it with a sample. I have the following code inside my page:
<script type="text/javascript">
$(document).ready(function() {
$('.deleteMemo').live('click', function() {
$.ajax({
[ajax call omitted for brevity]
});
});
$('.markAsViewed').live('click', function() {
$.ajax({
[ajax call omitted for brevity]
});
});
});
</script>
Now, depending on the page status in the page there could be:
- Only elements with "deleteMemo" class
- Only elements with "markAsViewed" class
- Both
I am experimentig that, in the first case (only "deleteMemo" elements), the jQuery code does'nt get called at all. I still have not did a try with the other cases but I have triple checked the code and even looked at it with fiddler.
Any suggestion?