jQuery – :input Selector

The jQuery input selector selects all input, textarea, select and button elements.

Source Code

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div class="div1">
<label>Text : </label><input type="text" />
</div>
<button>Click Here</button>

  
<script>
jQuery("button").click(function () {
	jQuery("div.div1 > :input").css({border:"3px #1E8CBE solid"});
});
</script>
</body>
</html>

Demo

Following example finds all input elements and create a border around them.

,

No comments yet.

Leave a Reply