javascript - Placeholder text is returned when using value property of input text box in form -
I am using webshim to provide html5 placeholder functionality in my text box in IE8.
This works fine when I submit the form - the field is empty, if the user has not entered anything.
But when I tried to make an aggressive request by requesting an AJAX request, the following line of code
document.getElementById ('idOfTextBox') value How can I avoid this behavior?
You can set it as optional
if (Document.getElementById ('idOfTextBox') .value == 'Placeholder') {document.getElementById ('idOfTextBox'). Value = ''; } Basically, if textbox value = placeholder, this value will be set to '' (empty string)
Comments
Post a Comment