[英]make visible div on dropdown select in jquery
I am developing the asp.net mvc application . 我正在开发asp.net mvc应用程序。 my one of forms requirement is that: It has dropdown filling up with let say A,B,C values.
我对表单的要求之一是:它有一个下拉列表,用A,B,C值填充。 If selected A then on UI there should be 2 text boxes should be visible and other should be invisible , if selected B, then must be add another 2 text boxes , i this way there should be 4 text boxes.
如果选择了A,则在UI上应该有2个文本框应该是可见的,其他应该是不可见的;如果选择了B,则必须添加另外2个文本框,这样就应该有4个文本框。 same for selection of C. I able to get the selected value by
对于C的选择也一样。我能够通过
$(document).ready(function() {
$('#NatureOfTransactionDropDown').change(function() {
var element = $(this).find('option').filter(':selected').text();
alert(element);
if (element == "A") {
//code
}
});
});
What I have to do. 我该怎么办。 I tried hide() show(), but i think it is not working for me.
我尝试了hide()show(),但我认为它对我不起作用。
use .css("display", "none");
使用
.css("display", "none");
for hiding, 藏起来
and .css("display", "block");
和
.css("display", "block");
for showing 用于显示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.