I am using jQuery AJAX and ASP.Net web methods. I need to check user data entered in to HTML controls, I know that there are a lot of jQuery plugins but I used them one by one, but no luck, the issue is they use <form id="" action=""></form> tag while I do not. Also I do not submit my form as it is a jQuery AJAX application. I want some fields to have only floating points and some not null. Can anyone help?
Here is my code:
<table width="100%">
<tr>
<td><asp:Label ID="lblcontry" runat="server" Text="Select Country"> </asp:Label></td>
<td>
<select id="cmbCountry">
<option value="0">Select Country</option>
</select>
</td>
</tr>
<tr>
<td><asp:Label ID="lblCname" runat="server" Text="City Name"></asp:Label></td>
<td><input type="text" id="txtCityName" /></td>
</tr>
<tr>
<td><asp:Label ID="lblDialCode" runat="server" Text="Dial Code"></asp:Label></td>
<td><input type="text" id="txtDialCode" /></td>
</tr>
<tr>
<td><asp:Label ID="lblKeywords" runat="server" Text="KeyWords"></asp:Label></td>
<td><textarea id="txtKeywords" cols="20" rows="2"></textarea></td>
</tr>
<tr>
<td></td>
<td>
<input type="button" id="btnsave" value="Save" />
<input type="button" id="btnCancel" value="Cancel" />
</td>
</tr>
</table>
$(document).ready(function () {
$("#btnsave").click(function () {
//here i want to check fields first and then save data.
SaveData();
});
}
I have imported all files and css.
1 Answer