[Solved] Empty input value passing as not empty


The placeholder text is actual text in the box. And ASP.NET is doing something funky to get it to behave like it does. I haven’t used it too much because of ASP.NET’s weirdness but its perfectly valid.

What is happening is that the text box has your prompt text and they click search so it isn’t empty like you think it should be.

You could put an if(text != 'My Prompt Text').

If your prompt text is a valid search the user could use, then I would suggest you track if the user has clicked on the text box with jQuery, the onclick even, and a Boolean stored as an attr on that element.

0

solved Empty input value passing as not empty