I have a block of code being generated dynamically using xforms and dojo.
The following block of jQuery works fine in chrome and firefox but not in IE:
jQuery('.premiumBlock').delegate('.dijitCheckBoxInput', 'click', function(){ // do something });
The code will then "do stuff" which is working correctly in chrome and firefox, but not IE.
Nearly everything is created dynamically including the class names.
I have read other similar SO queries where the majority of suggestions have been to change .delegate() to .live() or .on(). These suggestions do not work - it would merely change the ancestor that the event will bubble to.
Any ideas why this may not be working and, more specifically, how I can make it work?
Thanks
You could try something like:
$('#somecontainer').ajaxComplete(function() {
$(".premiumBlock").delegate(".dijitCheckBoxInputat","click",function() {
//do something
});
});
This should make it work in IE also
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.