Click here to Skip to main content
14,923,034 members
Please Sign up or sign in to vote.
1.33/5 (2 votes)
See more:
Hi All,
How to validate textbox and dropdownlist using jquery?

Thanks & Regards
Hari
Posted
Comments
Prasad Khandekar 23-Apr-13 1:18am
   
You have not mentioned anything about the validations. You can use $('ID_NAME').val() to retrieve the value of the form element. where ID_NAME is of form '#' + id value of id attribute of the form element.

Regards,

Hey you not specify which type of validation you required. so give for empty or not selected.


C#
if($('#idOfFeild').val()==''){
    $('#idOfFeild').val('Please input your data');
}

mydropdown = $('#myDropdown');
if (mydropdown.length == 0 || $(mydropdown).val() == "")
{
    alert("Please select anyone");
}
   

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