本文介绍了如何在按钮点击上使用Jquery Shake效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想要做的是在文本框为空时摇动文本框。但我无法做到这一点。 我正在做的如下: $( #BtnSubmit)。click(function(){ if ($( #txt1)。val()== ' ' || $( #TextBox1)。val()== ' ' || $( #TextBox2)。val()){ $( #txt1)。effect( shake) } }); < div id = keepTextBox > & nbsp;& nbsp;& nbsp ;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP; & nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& nbsp;& NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP; < asp:TextBox ID = txt1 ForeColor = 白色 runat = server 高度 = 30px 样式 = background-color:#46375E; > < / asp:TextBox > & nbsp;& nbsp; < asp:RequiredFieldValidator ControlToValidate = txt1 ID = rftxt1 runat = server SetFocusOnError = true > < / asp:RequiredFieldValidator > < asp:TextBox ID = TextBox1 ForeColor = 白色 runat = server 高度 = 30px 样式 = background-color:#46375E > < / asp:TextBox &g吨; &安培; NBSP;&安培; NBSP; < asp:RequiredFieldValidator ControlToValidate = TextBox1 ID = rfTextBox1 runat = server SetFocusOnError = true > < / asp:RequiredFieldValidator > < asp:TextBox ID = TextBox2 runat = server ForeColor = 白色 高度 = 30px 样式 = background-color:#46375E > < / asp:TextBox > & nbsp;& nbsp; < asp:RequiredFieldValidator ControlToValidate = TextBox2 ID = rfTextBox2 runat = server SetFocusOnError = true > < / asp:RequiredFieldValidator > < asp:按钮 ID = BtnSubmit runat = server 宽度 = 15% 文字 = 注册 ForeColor = 白色 样式 = background-color:#49A7E4; cursor:pointer; 高度 = 40px / > < / div > < / div > 我希望如果任何文本框为空,文本框应该是谢谢。解决方案 ( #BtnSubmit )。click(function(){ if ( ( #txt1)。val()== ' ' || ( #TextBox1)。val()== ' ' || What i want to do is to shake the textbox if the textbox is empty. But i a unable to do this.What i am doing is as follows :$("#BtnSubmit").click(function() { if ($("#txt1").val() == '' || $("#TextBox1").val() == '' || $("#TextBox2").val()) { $("#txt1").effect("shake") } });<div id="keepTextBox"> <asp:TextBox ID="txt1" ForeColor="White" runat="server" Height="30px" Style="background-color: #46375E;"></asp:TextBox> <asp:RequiredFieldValidator ControlToValidate="txt1" ID="rftxt1" runat="server" SetFocusOnError="true"></asp:RequiredFieldValidator> <asp:TextBox ID="TextBox1" ForeColor="White" runat="server" Height="30px" Style="background-color: #46375E"></asp:TextBox> <asp:RequiredFieldValidator ControlToValidate="TextBox1" ID="rfTextBox1" runat="server" SetFocusOnError="true"></asp:RequiredFieldValidator> <asp:TextBox ID="TextBox2" runat="server" ForeColor="White" Height="30px" Style="background-color: #46375E"></asp:TextBox> <asp:RequiredFieldValidator ControlToValidate="TextBox2" ID="rfTextBox2" runat="server" SetFocusOnError="true"></asp:RequiredFieldValidator> <asp:Button ID="BtnSubmit" runat="server" Width="15%" Text="SIGN UP" ForeColor="White" Style="background-color: #49A7E4; cursor: pointer;" Height="40px" /></div> </div>I want that if any textbox is empty the the textbox should shake. Thank you. 解决方案 ("#BtnSubmit").click(function() { if (("#txt1").val() == '' ||("#TextBox1").val() == '' || 这篇关于如何在按钮点击上使用Jquery Shake效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 23:28