Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I make project in php and want velidator for username field using java script
Posted
Comments
ZurdoDev 7-Jun-13 8:54am    
Where are you stuck?

1 solution

Something like this. I think you get the idea...

XML
<script type="text/javascript">
JavaScript
function ValideInput() {
    if(document.getElementById('name').value == '') {
        alert('Please enter a username!');
        return false;
    }else{
        return true;
    }
}
XML
<form action="randompage" onsubmit="return ValideInput();">
    <input id="name" type="text"><input type="submit" value="go">
</form>
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900