jQuery實(shí)現(xiàn)根據(jù)類型自動(dòng)顯示和隱藏表單
jquery實(shí)現(xiàn)表單根據(jù)單選按鈕進(jìn)行字段的動(dòng)畫切換,昨天寫的,感覺比起初學(xué)時(shí)寫的js/jquery有了很大進(jìn)步。。在最大化擴(kuò)展性的情況下經(jīng)可能使代碼精簡(jiǎn)。
html
<div class="control-group">
<label class="control-label">類型:</label>
<div class="controls control-row-auto" id="type">
</div>
<span class="auxiliary-text"></span>
</div>
<div class="control-group ctype ctype1 ctype2">
<label class="control-label">欄目模版:</label>
<div class="controls">
<select name="column_tpl" class="input">
</select>
</div>
<span class="auxiliary-text"></span>
</div>
<div class="control-group ctype ctype1">
<label class="control-label">文章模版:</label>
<div class="controls">
<select name="article_tpl" class="input">
</select>
</div>
<span class="auxiliary-text"></span>
</div>
<input type="hidden" name="tpl" id="tpl" value="" />
<div class="control-group ctype ctype3" style="display: none;">
<label class="control-label"><s>*</s>欄目鏈接:</label>
<div class="controls">
<input name="url" type="text" class="input-large" data-rules="{required:true,minlength:1,maxlength:30}">
</div>
<span class="auxiliary-text">內(nèi)部鏈接格式:模塊/控制器/方法...,外部鏈接格式:http://../../</span>
</div>
js
//根據(jù)類型自動(dòng)顯示和隱藏表單
var input_type=$('input[name=type]');
function typeChangeHandle(){
var ctypes=$('.ctype');
var type=$(this).val();
var hideCtypes=ctypes.filter(':not(.ctype'+type+')').slideUp(500,function () {
$('.ctype'+type).slideDown(500);
});
}
typeChangeHandle.apply(input_type);
input_type.on('change',typeChangeHandle);
input_type=null;
以上所述就是本文的全部?jī)?nèi)容了,希望大家能夠喜歡。
相關(guān)文章
Jquery UI震動(dòng)效果實(shí)現(xiàn)原理及步驟
如果你想你的博客頁(yè)面某些部分引起讀者的注意,你可以使這些部分震動(dòng),如廣告等等,今天這篇文章將介紹怎樣使你的頁(yè)面中的元素震動(dòng)起來(lái),感興趣的你可不要錯(cuò)過了哦,或許對(duì)你學(xué)習(xí)jquery ui 有所幫助2013-02-02
Jquery實(shí)現(xiàn)仿騰訊娛樂頻道焦點(diǎn)圖(幻燈片)特效
這篇文章主要介紹了Jquery實(shí)現(xiàn)仿騰訊娛樂頻道焦點(diǎn)圖(幻燈片)特效,需要的朋友可以參考下2015-03-03
jquery實(shí)現(xiàn)簡(jiǎn)單易懂的圖片展示小例子
圖片展示想必大家都見到過吧,下面有個(gè)不錯(cuò)的例子,通俗易懂,使用jquery實(shí)現(xiàn)的,感興趣的朋友不要錯(cuò)過2013-11-11
jQuery實(shí)現(xiàn)的超鏈接提示效果示例【附demo源碼下載】
這篇文章主要介紹了jQuery實(shí)現(xiàn)的超鏈接提示效果,結(jié)合實(shí)例形式對(duì)比分析了jQuery實(shí)現(xiàn)的帶有l(wèi)oading動(dòng)態(tài)圖效果的提示文字以及默認(rèn)提示文字顯示效果,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2016-09-09
jQuery實(shí)現(xiàn)的隔行變色功能【案例】
這篇文章主要介紹了jQuery實(shí)現(xiàn)的隔行變色功能,結(jié)合具體實(shí)例形式分析了jQuery事件響應(yīng)、元素遍歷及屬性動(dòng)態(tài)操作相關(guān)使用技巧,需要的朋友可以參考下2019-02-02
jQuery實(shí)現(xiàn)火車票買票城市選擇切換功能
本文通過實(shí)例代碼給大家分享了jQuery實(shí)現(xiàn)火車票買票城市選擇切換功能,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧2017-09-09

