开发者

Closest form append doesnt work

开发者 https://www.devze.com 2022-12-29 20:58 出处:网络
I am using the following code: $(\".searchBtn\").closest(\'form\').sub开发者_运维技巧mit(function () {

I am using the following code:

$(".searchBtn").closest('form').sub开发者_运维技巧mit(function () {
   $(this).find('.showComments tr:last').after("<tr><td>TEST</td></tr>");
});

and I have a

<form>
<div>
<table class="showComments"><tr><td></td></tr></table>
</div>
<input type="submit" class="searchBtn" value="Submit">
</form>

in my HTML page.

However, this code doesn't work. Any ideas?

Thanks

Joel


Works fine for me. Maybe you just need to throw in a return false?

http://jsfiddle.net/h7WCv/

0

精彩评论

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