Solved: jquery make readonly textbox

The main problem is that if you try to change the value of a readonly textbox, the change will not be saved and will be lost the next time the textbox is used.

$("#textbox").attr("readonly", "readonly");

This code line is using the jQuery attr() method to set the readonly attribute of an element with the id of “textbox” to “readonly”. This will make the element read only so that users cannot edit it.


A textbox is a type of input field in jQuery that allows you to enter text. You can use a textbox to collect user input, or to display information on a web page.

To create a textbox in jQuery, you first need to create an instance of the jqTextBox object. Then, you can set the properties of the textbox object to specify its behavior.

The following example shows how to create a simple textbox object and set its properties:

var myTextBox = new jqTextBox(); myTextBox.text = “This is some text”; myTextBox.width = 100; myTextBox.height = 50;

You can use the getters and setters of the jqTextBox object to change the properties of the textbox object. The following example shows how to change the width and height of the textbox object:

myTextBox.width = 200; myTextBox.height = 75;

readonly jQuery

jQuery is a popular JavaScript library for DOM manipulation and event handling. One of the features of jQuery is that it is “readonly.” This means that you cannot change the values of any of the variables in jQuery after you have initialized it.

Related posts:

Leave a Comment