I am using the following statement to make it readonly but it is not working.
$(\'#cf_1268591\').attr(\"readonly\", \"readonly\");
I don\
There is no such thing as a read-only drop-down. What you could do is reset it to the first value manually after each change.
$("select").change(function(event) {
$(this).val($(this).find("option").first().val());
});
http://jsfiddle.net/4aHcD/
I've found, a better way to do this is to use CSS to remove pointer-events and modify the opacity on the drop down (try 0.5). This gives the appearance to the user that it is disabled as normal, but still posts data.
Granted this has some issues with backwards compatibility, but is in my opinion a better option than getting around the annoying disabled/readonly issue.
It´s work very well
$('#cf_1268591 option:not(:selected)').prop('disabled', true);
With this I can see the options but I can't select it
I had the same problem, my solution was to disable all options not selected. Very easy with jQuery:
$('option:not(:selected)').attr('disabled', true);
Edit => If you have multiple dropdowns on same page, disable all not selected options on select-ID as below.
$('#select_field_id option:not(:selected)').attr('disabled', true);
Easiest option for me was to make select as readonly and add:
onmousedown="return false" onkeydown="return false"
You don't need to write any extra logic. No hidden inputs or disabled and then re-enabled on form submit.
To simplify things here's a jQuery plugin that does that without the hassle: https://github.com/haggen/readonly