Home >>jQuery Tutorial >jQuery disabled Selector

jQuery disabled Selector

jQuery disabled Selector

jQuery disabled selector in jQuery is used to selects all disabled form elements.

Syntax:
$(":disabled")
Here is an Example of jQuery :disabled Selector

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(":disabled").css("background-color", "#c0ed1f");
});
</script>
</head>
<body>
<form action="">
Name: <input type="text" name="user"><br>
ID:<input type="text" name="id" disabled="disabled"><br>
Age:
<select disabled="disabled">
<option>20-30</option>
<option>30-50</option>
<option>50+</option>
</select><br>
<input type="submit">
</form>
</body>
</html>

Output:
Name:
ID:
Age:

No Sidebar ads