Search

Sunday, September 6, 2015
0 comments

Select box validation using JQuery

11:09 PMSunday, September 6, 2015
Introduction
In this article i will show you how to validate select box using JQuery. Example of select box validation using JQuery. First to get the id of the select box then get the value of it.

Source Code

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="Scripts/jquery-1.10.2.js"></script>
    <script>
        $(function () {
            $("#Button1").click(function () {
                var a = $("#d1").val();
                if(a=="0")
                {
                    alert("Please select");
                }

            });


        })
    </script>
</head>
<body>
    <select name="d11" id="d1">
        <option value="0" >Select</option>
        <option value="1">Apple</option>
    </select>
    <input id="Button1" type="button" value="button" />
</body>
</html>

Code generate the following output

Select box validation using JQuery

Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top