使人们看到格在下拉列表中选择jQuery中 [英] make visible div on dropdown select in jquery

查看:118
本文介绍了使人们看到格在下拉列表中选择jQuery中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发asp.net MVC应用程序。我的形式之一要求是:
它有下拉用let填满说A,B,C值。如果选择一个,然后在UI上应该有两个文本框应该是可见的和其他应是无形的,如果选B,则必须添加其他两个文本框,我这种方式应该有4文本框。同为
C.选择
我能得到所选择的值

I am developing the asp.net mvc application . my one of forms requirement is that: It has dropdown filling up with let say A,B,C values. 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. same for selection of C. I able to get the selected value by

$(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.

推荐答案

使用的.css(显示,无); 隐蔽,

的.css(显示,块); 用于显示

这篇关于使人们看到格在下拉列表中选择jQuery中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆