Javascript examples for jQuery Selector:disabled
The :disabled selector selects all disabled form elements.
The following code shows how to select all the disabled form elements:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(":disabled").css("background-color", "blue"); });/*from w ww .j a v a 2 s . co m*/ </script> </head> <body> <form action=""> Name: <input type="text" name="user"><br> ID:<input type="text" name="id" disabled="disabled"> New ID:<input type="text" name="id"> Age: <select disabled="disabled"> <option>20-30</option> <option>30-50</option> <option>50+</option> </select> <select> <option>20-30</option> <option>30-50</option> <option>50+</option> </select> <input type="submit"> </form> </body> </html>