开发者

Avoiding water mark text saving

开发者 https://www.devze.com 2023-01-06 18:03 出处:网络
How we can avoid the saving of wa开发者_C百科termark text of a textbox while saving? In my application, I have one textbox which has a watermark text like enter value(by using ajax textbox watermark e

How we can avoid the saving of wa开发者_C百科termark text of a textbox while saving? In my application, I have one textbox which has a watermark text like enter value(by using ajax textbox watermark extender). when i save the form, the text box returns the value of some white space corresponding the letters of the water mark text. And i used to trim(). but it is saving as old manner. Please help me for avoiding this one. thanks in advance..


You can follow the approach used by the jquery watermark plugin.

The plugin listens on form submit, intercepts the submit, and sets the value of any inputs that contain only the watermark text to the empty string before allowing the submit to continue. You could do the same thing with ms ajax.

If you're open to it, and if you want to be a generally happier person, you could just add in jquery and the watermark plugin. It will take care of this issue for you. You can find the plugin here.


Alternatively you can use HTML5 placeholders, or jQuery hint that handles it for you:

http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/

http://diveintohtml5.ep.io/detect.html#input-placeholder

0

精彩评论

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