I have been struggling to get my jquery gritter notification to work after a partial postback, after lots of googling i found many suggestions recommending the pageLoad function. I'm not sure if I have implemented it right but now the gritter notification doesn't show at all, even before a partial or full postback.
Can you see where I am going wrong? Javascript/jquery isn't my strong point.
<script type="text/javascript">
function pageLoad() {
$(function () {
$('.buy-notify').click(function () {
var spn = this.attributes.getNamedItem('PartNumber').value;
$.gritter.add({
title: 'Order notification..',
text: 'Adding ' + spn + ' to basket',
time: 1000
});
return true;
});
});
};
</script>
Thanks in advance,
Dave
$(function () { ... }); is called on page load, you don't need to wrap it in a function called pageLoad.
If your
.buy-notifyelements are added after page load, you might want to use.live('click', function() ...instead of the.click(function() ...binding, since.clickonly binds to elements visible to jQuery on initial page load.