Jquery不能正常工作的按钮点击

Jquery not working properly for button click

本文关键字:按钮 工作 不能 常工作 Jquery      更新时间:2023-09-26

非常简单的代码,由于某些原因,我尝试将不起作用!显然,我已经导入了Jquery、jqueryUI、ajax,以及所有需要导入的东西(不止一次!)但是由于某些原因,这个按钮不希望使用Jquery点击!我得到了它的工作与onClick,但我想使用jquery这个。SOS !

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script src="jquery-1.11.3.min.js"></script>
<script>
$("#heyo").click(function(){
alert();
});
$("input").click(function(e){
var id1 = e.target.id;
alert(id1);
 });
$('input[type="button"]').click(function(){
alert();
});
function pie(){
//alert();
}
</script>
<body>
loading...
<input type="button" id="heyo" onclick="pie()" value="ff" />
</body>

$(document).ready(function() {})包装jquery代码,以确保所有DOM对象在使用jquery访问它们之前都已加载:

 $(document).ready(function() {
       $("#heyo").click(function(){
         alert();
       });
       $("input").click(function(e){
          var id1 = e.target.id;
          alert(id1);
        });
        $('input[type="button"]').click(function(){
          alert();
          });
   });