How to use .on() with generated elements so that it works in <=IE8
Hi, I have a little function that I need to call when I submit a form. The form is generated dynamically from another function. What I am using works fine in Chrome, Firefox and IE9+ but it does not in IE8 and below. Here is my code:
- $('#map').on('submit', 'form', function(event) {
- event.preventDefault();
- var solicitorID = $(this).attr('id');
- solicitorRequest(solicitorID,applicationID);
- });
In IE8 no errors are thrown - the form just simply refreshes the page as it would without the jQuery. I've used breakpoints and the .on method is initiated on page load (#map is the closest parent that exists at this stage) but it never kicks in when I actually submit the form so it's not a problem with preventDefault or anything like that.
Are there any known bugs regarding .on() and IE8 when generated elements are involve? If so is there a workaround or am I simply doing something wrong here?