开发者

NOD name for VALUE?

开发者 https://www.devze.com 2023-01-16 01:40 出处:网络
I\'ve a few inputs and I want to clear their values after clicking. How to? <input type=\"text\" value=\"Name\" />

I've a few inputs and I want to clear their values after clicking. How to?

 <input type="text" value="Name" />

I've tried:

$(this).inputValue(""); 

But it doesn't work. If I'm unable to change the value, how to add text to the input ($(this).text(""); works very well in, for example, texta开发者_StackOverflowreas).

Thanks!


Use .val(newValue) for setting the value of any input type element (including <textarea> and <select>), like this:

$("input:text").click(function() {
  $(this).val(""); 
});
0

精彩评论

暂无评论...
验证码 换一张
取 消