English 中文(简体)
显示 在完成上述所有各行各业所有退学选择之后,再行。
原标题:Display Next row after completing selection of all dropdowns in the all above rows
  • 时间:2011-07-19 13:09:11
  •  标签:
  • jquery

My requirement is to display a row if all drop downs in the above row s value is not "Select Answer".If Any drop down s answer is "Select Answer" all the drop downs in the below row of its row should be hidden. How can i achieve that. Any idea.
Below is my HTML code..

 <table>
<tr>
    <td>
         <select  id="S1"  class="dropdown">
            <option value="" selected="selected">Select answer</option>
            <option value="1" >A</option>
            <option value="2">B</option>
            <option value="3">C</option>
        </select>
    </td>
            <td>
    <select id="S2"  class="dropdown">
        <option value="" selected="selected">Select answer</option>
        <option value="1">A</option>
        <option value="2" >B</option>
        <option value="3">C</option>
    </select>
    </td>

</tr>
<tr>
    <td>
    <select id="S2"  class="dropdown">
        <option value="" selected="selected">Select answer</option>
        <option value="1">A</option>
        <option value="2" >B</option>
        <option value="3">C</option>
    </select>
    </td>
            <td>
    <select id="S2"  class="dropdown">
        <option value="" selected="selected">Select answer</option>
        <option value="1">A</option>
        <option value="2" >B</option>
        <option value="3">C</option>
    </select>
    </td>
    </tr>
 </table>
最佳回答

我创建了一个jsFiddle,其中有工作守则。 我建议加以修改,以使用更多的分辨率,而且你必须补充一些逻辑,以检查分数(最高点),以确保只显示需要显示的分数,但这应当使你有一个很好的起点来回答你的问题。

问题回答

首先是使用直线风格的隐蔽,或最好用碎打。 之后,情况如下:

$( select.dropdown ).bind( change ,function() {
    var showNext = true;
    $( select.dropdown:visible ).each( function() {
        if ( $(this).val() ==    ) showNext = false; 
    });
    if ( showNext ) {
       $( select.dropdown:hidden:first ).show();
    }
});

我认为,它可能做得更好,但不能坐在一个桌子上,你应该真正有你选择的标签内容。 这需要藏匿,并与相关的选择显示。

首先,所有女方都应在一页上独一无二,这在你所指明的标志上并非一页。 请参看以下法典:

$(function(){
var firstTr = $("table tr:first");
firstTr.next("tr").hide();

firstTr.find( select.dropdown ).bind( change ,function() {
    var showNextTr = $(this).val() != "";
    if(showNextTr){
      firstTr.find( select.dropdown ).each( function() {
          if ( $(this).val() ==    ){ 
             showNextTr = false; 
             return false;
          }
      });
    }

    if ( showNextTr ) {
       firstTr.next("tr").show();
    }
    else{
       firstTr.next("tr").hide();
    }
});
});




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签