Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a dropdown readonly using jquery?

Tags:

jquery

I am using the following statement to make it readonly but it is not working.

$('#cf_1268591').attr("readonly", "readonly");  

I don't want make it disabled, I want to make it readonly.

like image 980
Karim Ali Avatar asked Nov 11 '11 21:11

Karim Ali


People also ask

How set readonly property of dropdown in jquery?

$('#cf_1268591'). attr("readonly", "readonly");

How do I make a dropdown readonly?

Dropdown (select element) is always read only. User do not edit it. User can select any of the option of its own chice. Unlike other html elements, it dont have a attribute which can make the element readony and prevent users to change its value.

How do I make a form read only in jquery?

Try this: $('#form1 input'). attr('readonly', 'readonly');

How do I make a drop down list read only in asp net?

Show activity on this post. TextBox. ReadOnly = false; for readonly.


1 Answers

$('#cf_1268591').attr("disabled", true);  

drop down is always read only . what you can do is make it disabled

if you work with a form , the disabled fields does not submit , so use a hidden field to store disabled dropdown value

like image 70
Kanishka Panamaldeniya Avatar answered Oct 14 '22 08:10

Kanishka Panamaldeniya