HTML form readonly SELECT tag/input

前端 未结 30 2778
陌清茗
陌清茗 2020-11-22 08:28

According to HTML specs, the select tag in HTML doesn\'t have a readonly attribute, only a disabled attribute. So if you want to keep

30条回答
  •  时光取名叫无心
    2020-11-22 09:13

    This is the simplest and best solution. You will set a readolny attr on your select, or anyother attr like data-readonly, and do the following

    $("select[readonly]").live("focus mousedown mouseup click",function(e){
        e.preventDefault();
        e.stopPropagation();
    });
    

提交回复
热议问题