jQuery Selector :enabled

Introduction

The :enabled selector selects all enabled form elements.

$(":enabled")

Select all the enabled form elements:

$(":enabled")

View in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $(":enabled").css("background-color","red");
});/*  www .j  a v a  2s .c o  m*/
</script>
</head>
<body>

<form action="">
name: <input type="text" name="user"><br>
id:<input type="text" name="id" disabled="disabled">

age:
<select disabled="disabled">
  <option>2</option>
  <option>3</option>
  <option>5+</option>
</select>
<input type="submit">
</form>

</body>
</html>



PreviousNext

Related