How to make a dropdown readonly using jquery?

后端 未结 21 1123
终归单人心
终归单人心 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:23

    Maybe you can try this way

    function myFunction()
    {
       $("select[id^=myID]").attr("disabled", true);
       var txtSelect = $("select[id^=myID] option[selected]").text();
    }
    

    This sets the first value of the drop-down as the default and it seems readonly

提交回复
热议问题