[英]<button> text disappears when using jQuery slideUp()/slideDown()
I have 3 sections on a form which slideDown() when a checkbox is checked and slideUp() when the checkbox is unchecked. 我在窗体上有3个部分,当选中一个复选框时为slideDown(),而未选中该复选框时为slideUp()。
In one part of the form i'm using a simple button to run a function. 在表单的一部分中,我使用一个简单的按钮来运行功能。
If I uncheck the checkbox to slide the content up and then recheck it to slide the content back down again, the text in the button disappears and leaves me with a tiny button, which still works, but will not inform the user of what it does. 如果我取消选中该复选框以使内容向上滑动,然后再次选中它以使内容再次向下滑动,则按钮中的文本消失,并留下一个小按钮,该按钮仍然有效,但不会通知用户它的作用。
Any help would be great. 任何帮助都会很棒。
Thanks 谢谢
Richard 理查德
Ok, so in my function to slide the content up I had the following line: 好的,所以在我向上滑动内容的功能中,我有以下几行:
$("#" + section + " :input").val("");
It turns out that this not only clears the obvious fields, text etc, it also wipes out the button text. 事实证明,这不仅清除了明显的字段,文本等,而且还清除了按钮文本。
I simply changed this line of code to: 我只是将以下代码行更改为:
$("#" + section + " :input[type='text']").val("");
Thanks for your prompt replies! 感谢您的及时答复!
Richard 理查德
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.