Jquery on submit not responding -
so have form wuth button. on click need use run google analytics code (_gap.push). wasnt working have decided alert test. alert showing word "outside" works alert showing word "inside" not working. means not going function
js code
applyregisternewuserlistener: function() { alert ("outside") // form attempts register users $(document).on('submit', 'form#signup-form', function() { alert ("inside" _gaq.push(['_trackevent', 'register', 'account', 'form',, false]); }) },
html
<form method="post" id="#signup-form"> <input type="submit" value="submit"> </form>
i cannot understand problem. function being called too.
the #
sign should not in id
form markup.
<form method="post" id="signup-form">
there syntax error in section of code.
$(document).on('submit', '#signup-form', function(event) { event.preventdefault(); //do not submit form alert ("inside"); // alert missing ); _gaq.push(['_trackevent', 'register', 'account', 'form',"", false]); //replace undefined param }); //add ;
i'm not sure code needs in listener
function. included regular script since not execute until submit event fired.
Comments
Post a Comment