在下拉列表中更改表行选择不起作用

时间:2018-05-27 12:29:44

标签: jquery html-table onchange

我有一个用于存储用户信息的页面,分为4页。我想要的是更改位于第一页上的选择选项的第4页上的某些行。我使用jQuery这样做但目前不成功。这是我的代码请纠正我。

x=0:5;
y=0:5;
z=rand(1,6); %random data to simulate your time
xx=[x' x']; %this allows you to plot the data using surf in 3d
yy=[y' y']; %same as for xx
z1=zeros(size(xx)); % we don't need z-data so we're making it a matrix of zeros
zc=[z' z']; %input here your time data values, if x/y then you can just use those instead of z
hs=surf(xx,yy,z1,zc,'EdgeColor','interp') %// color binded to "z" values, choose interp for interpolated/gradual color changes, flat makes it sudden
colormap('hsv') %choose your colormap or make it yourself
view(2) %// view(0,90)
hcb=colorbar; %add a colorbar
$(document).ready(function () {
            $('#ddlCategory').change(function () {
                if (this.value == "Others") {
                    $('#Other').show();
                } else {
                    $('#Other').hide();
                }

            });
        });

1 个答案:

答案 0 :(得分:2)

使用嵌套的table有时会在元素显示方式上产生冲突。如果您将IDstyle放在table本身上而不是tr容器上,则可以使用以下示例:



$(document).ready(function () {
            $('#ddlCategory').change(function () {
                if (this.value == "Others") {
                    $('#Other').show();
                } else {
                    $('#Other').hide();
                }

            });
        });

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
    <html>
    <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
    <meta charset=utf-8 />
    <title>JS Bin</title>
     </head>
    <body>
    <select id="ddlCategory">
                        <option>Choose</option>
                        <option value="Value1">Value1</option>
                        <option value="Value2">Value 2</option>
                        <option value="Others">Others</option>
                    </select>
    <table>
            <tr>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="Category: " />
                </td>
                <td>
                    
                </td>
            </tr>
    
            <tr>
              <table id="Other" style="display: none">

              <tbody>
              <tr>
                <td>
                    <input id="txtOthers" type="text" runat="server" />
                </td>
              </tr>
                <tr>
                <td>
                    <input id="txtOthers" type="text" runat="server" />
                </td>
              </tr>
               <tr>
                <td>
                    <input id="txtOthers" type="text" runat="server" />
                </td>
              </tr>
          </tbody>      
       </table>

             
            </tr>
        </table>
    </body>
    </html>
&#13;
&#13;
&#13;