开发者

Basic element class swap, not showing correct alert message, using JQuery?

开发者 https://www.devze.com 2023-03-20 09:07 出处:网络
I have this code I\'m working on, see link: http://jsfiddle.net/PqsAD/3/ The problem is depending o开发者_开发问答n a elements class name (.no-submit or .btn) the click function should show a differ

I have this code I'm working on, see link:

http://jsfiddle.net/PqsAD/3/

The problem is depending o开发者_开发问答n a elements class name (.no-submit or .btn) the click function should show a different alert message. Although this isnt working. Clearly I have missed something.

Would really appreciate it, if someone could help me shed some light on the matter. Thanks


Change your handlers in that way:

$('.no-submit').live('click', function(){ 
    alert('The form has NOT been submitted!');
});    

$('.btn').live('click', function(){ 
    //$(this).parent().find('form').submit();
    alert('The form has been submitted!');
});  

fiddle: http://jsfiddle.net/PqsAD/5/

0

精彩评论

暂无评论...
验证码 换一张
取 消