本文介绍了选择节目div的jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个关于jQuery的问题。如果用户在html中选择值为0的Presmerovanie,选择id为typ,我想显示ID为pres的div。这里是代码:
< dl>
< dt>< label for =typ> Typ< / label>< / dt>
< dd>
< select id =typsize =1>
< option value =1>Normálna< / option>
< option value =0> Presmerovanie< / option>
< / select>
< / dd>
< / dl>
< div id =presstyle =display:none;>
< dl>
< dt>< label for =presmerovat> Presmerovat na< / label>< / dt>
< dd>
< select id =presmerovatsize =1>
< option>类别1< / option>
< option>类别2< / option>
< / select>
< / dd>
< / dl>
< / div>
是否有可能?
解决方法
$(#typ)。on(change,function(){
$(#pres)。hide() ;
if($(this).val()=='0'){
$(#pres)。show();
}
});
i have one question about jQuery. If user select "Presmerovanie" with value "0" in html select with id "typ" i want to show div with id "pres" . Here is the code:
<dl>
<dt><label for="typ">Typ</label></dt>
<dd>
<select id="typ" size="1">
<option value="1">Normálna</option>
<option value="0">Presmerovanie</option>
</select>
</dd>
</dl>
<!-- Len ak je presmerovatelna -->
<div id="pres" style="display: none;">
<dl>
<dt><label for="presmerovat">Presmerovat na</label></dt>
<dd>
<select id="presmerovat" size="1">
<option>Category 1</option>
<option>Category 2</option>
</select>
</dd>
</dl>
</div>
<!-- Koniec ak je presmerovatelna -->
is it possible?
解决方案
$("#typ").on("change", function() {
$("#pres").hide();
if ( $(this).val() == '0' ) {
$("#pres").show();
}
});
这篇关于选择节目div的jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
08-30 20:03