給Easyui-Datebox設(shè)置隱藏或者不可用的解決方法
我們公司做的是一套安全監(jiān)測(cè)系統(tǒng)。所以呢對(duì)于前臺(tái)頁(yè)面沒(méi)有像一些門(mén)戶(hù)網(wǎng)站布局那么豐富,特效特別炫。目前只需要一套簡(jiǎn)單的UI界面即可,所以我選擇了用easyui進(jìn)行搭建,easyui是一種基于jQuery的用戶(hù)界面插件集合。使用easyui你不需要寫(xiě)很多代碼,你只需要通過(guò)編寫(xiě)一些簡(jiǎn)單HTML標(biāo)記,就可以定義用戶(hù)界面。方便而且也比較美觀。但是隨著項(xiàng)目的進(jìn)展,對(duì)于一些功能的選擇上,需要給一些元素加一些樣式。漸漸我發(fā)現(xiàn)easyui的一些控件對(duì)css的兼容性不是很好。于是我總結(jié)了一些解決方法如下,我解決的是easyui-datebox控件的隱藏。除此之外我也總結(jié)了一些其他控件隱藏或者設(shè)置不可用的方法,希望可以提供一些建議。
1.validatebox可以用的用法:前兩種適用于單個(gè)的validatebox;
第三種應(yīng)用于整個(gè)form里面的輸入框;
$("#id").attr("readonly", true); ----- $("#id").removeAttr("readonly");
$("#id").attr("readonly", "readonly"); ----- $("#id").removeAttr("readonly");
$("#Form :input").attr("readonly", "readonly"); //對(duì)form里面的禁用
$("input").attr("readonly", "readonly"); //對(duì)所有的input標(biāo)簽禁用
2.combobox禁用啟用用法:
$("#id").combobox({ disabled: true }); ----- $("#id").combobox({ disabled: false});
$("#id").attr("readonly", "readonly"); //對(duì)單個(gè)禁用 ----- $("#id").removeAttr("readonly");
$("#fm .easyui-combobox").combobox({ disabled: true }); //對(duì)form里面的下拉框禁用
$("#ID").combobox("disable"); ------ $("#ID").combobox("enable");
3.datebox與datetimebox禁用啟用方法:
$("#fm .easyui-datebox").datebox({ disabled: true }); ----- $("#fm .easyui-datebox").datebox({ disabled: false});
$("#id").attr("readonly", "readonly"); ----- $("#id").removeAttr("readonly");
$("#fm .easyui-datetimebox").datetimebox({ disabled: true }); ----- $("#fm .easyui-datetimebox").datetimebox({ disabled: true });
4.還有一種比較投機(jī)取巧的方法,但是也可以用 例子如下:
<div id=" divParent"style="margin:10px 0;"> <input id='test' class="easyui-datebox" ></input></div>
現(xiàn)在我要隱藏那個(gè)input ,既然不兼容,那我就隱藏他父元素。
$("#divParent" ).css("display", "none");
以下是設(shè)置不可用的方法:
$("#test").datebox({
disabled: true
});
相關(guān)文章
簡(jiǎn)單實(shí)現(xiàn)jQuery上傳圖片顯示預(yù)覽功能
這篇文章主要教大家如何簡(jiǎn)單實(shí)現(xiàn)jQuery上傳圖片顯示預(yù)覽功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-08-08
jquery 學(xué)習(xí)之二 屬性(html()與html(val))
取得第一個(gè)匹配元素的html內(nèi)容。這個(gè)函數(shù)不能用于XML文檔。但可以用于XHTML文檔。2010-11-11
jQuery對(duì)JSON數(shù)據(jù)進(jìn)行排序輸出的方法
這篇文章主要介紹了jQuery對(duì)JSON數(shù)據(jù)進(jìn)行排序輸出的方法,涉及jQuery中g(shù)etJSON與sort等方法的使用技巧,需要的朋友可以參考下2015-06-06
jQuery+CSS 實(shí)現(xiàn)的超Sexy下拉菜單
早前發(fā)現(xiàn)了 Soh Tanaka 分享的非常 Sexy 的 Drop Down Menu w/ jQuery & CSS,稍作修改實(shí)現(xiàn)了多級(jí)下拉,并實(shí)現(xiàn)了 ASP.NET 中通過(guò)輸出 HTML 動(dòng)態(tài)創(chuàng)建版本,有興趣的童鞋可以包裝成 Server Control。2010-01-01
jQuery插件FusionCharts實(shí)現(xiàn)的2D餅狀圖效果【附demo源碼下載】
這篇文章主要介紹了jQuery插件FusionCharts實(shí)現(xiàn)的2D餅狀圖效果,結(jié)合完整實(shí)例形式分析了FusionCharts插件2D餅狀圖繪制相關(guān)實(shí)現(xiàn)技巧,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2017-03-03

