How to use Text Selector Method in JQuery

This article describe about :text Selector Method in JQuery.
  • 1642

Use :text Selector method in jQuery

We select specified input elements with type="text".

This method put the text value for input element.

Example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $(":text").css("background-color", "red");

    });

</script>

</head>

<body>

<form action="">

Name: <input type="text" name="user" />

<br />

Password: <input type="password" name="password" />

 

<input type="reset" value="Reset" />

<input type="submit" value="Submit" />

<br />

</form>

</body>

</html>

Output

op1.jpg

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2019 DotNetHeaven. All rights reserved.