jQuery onClick事件 [英] jQuery onClick event
本文介绍了jQuery onClick事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
无法正常工作.任何帮助将是巨大的.我有点像jquery的初学者.
Cant seem to get this working. Any help would be great. I am somewhat of a beginner with jquery.
$('#add_button').click(function () {
$("#add_button").hide();
});
这是HTML
<input id='add_button' type='submit' class='add_now' value='' />
看起来很简单,但是单击输入没有任何作用.有没有其他针对输入的方法?谢谢.
Seems simple enough, but clicking on the input does nothing. Is there a different method for targeting inputs? Thanks.
推荐答案
确保在脚本之前包含jQuery:
Make sure you include jQuery before your script:
<script src="http://code.jquery.com/jquery-latest.js"></script>
并将您的代码放入可用于文档的函数中
And put your code inside a document-ready function:
$(document).ready(function () {
$('#add_button').click(function () {
$("#add_button").hide();
});
});
这篇关于jQuery onClick事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文