点按钮上的jquery不起作用 [英] The jquery on button click doesnt work
本文介绍了点按钮上的jquery不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在点击button1时打印一个aler msg。但是这不起作用..这是错误吗?
I want to just print an aler msg when button1 is clicked.But this not work..whts the error?
$(document).ready(function ()
{
$("#Button1").click(function ()
{
alert("hi");
});
我使用了以下按钮
< asp:Button ID =Button1runat =serverText =Button/>
I used the following button
<asp:Button ID="Button1" runat="server" Text="Button" />
推荐答案
(document).ready(function()
{
(document).ready(function () {
( #Button1)。click(function()
{
alert( hi);
});
("#Button1").click(function () { alert("hi"); });
我使用了以下按钮
< asp:Button ID =Button1runat =serverText =但是ton/>
I used the following button
<asp:Button ID="Button1" runat="server" Text="Button" />
试试这个
Try this
<asp:button id="Button1" runat="server" text="Button" ClientIDMode="Static" />
如果您想使用ID of他在jquery中按下Button1然后你需要将ClientIDMode设置为静态。
If you want to use the ID of the button as "Button1" in jquery then you need to set the ClientIDMode to static.
这篇关于点按钮上的jquery不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文