Jquery “readonly” API

If we want to make a text box readonly in jquery . There is an API available for us .

(i.e)   $(id).attr(“readonly”,true);

example for this script –

<script type="text/javascript" src="javascripts/jquery-1.3.2.min.js"></script>
<script type = "text/javascript">
$(document).ready(function () {
$("#button_one").click(function() {
<input type = "text" id = "text_box_one">
<input type = "button" value = "click here" id = "button_one" >

Enter value into text box , after clicking the button . text box will become readonly .

We cannot edit or enter the value 🙂



About sathia

Web developer at cloudmint
This entry was posted in Web. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s