如果文本框不为空,如何显示按钮?
问题描述:
如果文本框不为空,我想显示一个按钮。
我尝试了什么:
否则清空文本框值,然后隐藏按钮,就像在jQuery中切换一样。我怎样才能做到这一点?这里是小提琴......
[ ^ ]
I want to show a button if the text box is not empty.
What I have tried:
Otherwise empty the textbox value, then hide button like toggle in jQuery. How can I do this? here is fiddle...
[^]
答
也许下面的函数可以工作,
Perhaps the following function would work,
( #txtBoxClientId)。change( function (){ // 您的keyup功能也正确
if (
("#txtBoxClientId").change(function () { // Your keyup function was also correct if(
( this )。val() == ){
// 如果文字为空,
(this).val() == "") { // If text is empty,