按钮单击事件不起作用 [英] Button Click event is not working
本文介绍了按钮单击事件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Ajax调用的按钮点击事件中显示hello消息。但是,这不起作用。
Hi, I want to show "hello" message in button click event which is calling by Ajax. But, this is not working.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
script type="text/javascript">
$('#readfile').click(function(){alert("hello");});
</script>
</head>
<body>
<button id="readfile" name="readfile">show</button>
</body>
</html>
请告诉我为什么这不起作用?我的代码有什么问题吗?
Please tell me why this is not working ? Is there any problem in my code ?
推荐答案
(' #readfile')。单击( function (){alert( 你好跨度>);});
< / script>
('#readfile').click(function(){alert("hello");}); </script>
</head>
<body>
<button id="readfile" name="readfile">show</button>
</body>
</html>
请告诉我为什么这不起作用?我的代码有问题吗?
Please tell me why this is not working ? Is there any problem in my code ?
在文档就绪函数中包装.click分配。
Wrap the .click assignment in the document ready function.
(document).ready(function(){
(document).ready(function() {
这篇关于按钮单击事件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文