I`m newbie in jquery.
Got the following code:
`<ul> <li><input type = "text"> <input type = "button" value = "Save">
How do I validate the textbox for user input required on clicking the button save and display error message next to the save button?
I`m newbie in jquery.
Got the following code:
`<ul> <li><input type = "text"> <input type = "button" value = "Save">
How do I validate the textbox for user input required on clicking the button save and display error message next to the save button?
There appears to be a Validation Plug-In for jQuery. Have you looked at this already?
If not, it appears to do exactly what you want, and there is plenty of documentation right there to get started.
You can try something like
<html>
<head>
<script type="text/javascript">
function Test(txtCheck, lblCheck)
{
if (txtCheck.value == "")
lblCheck.innerHTML = "Textbox is empty";
else
lblCheck.innerHTML = "";
}
</script>
</head>
<body>
<input type="text" id="txtCheck" />
<input type="button" value="Save" onclick="Test(txtCheck, lblCheck);"/>
<label id="lblCheck"/>
</body>