How to make a dropdown readonly using jquery?

后端 未结 21 1168
终归单人心
终归单人心 2020-12-02 06:54

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

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

I don\

21条回答
  •  情话喂你
    2020-12-02 07:31

    $('#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

提交回复
热议问题