1

別のフォームでの選択に基づいて非表示のフォーム セクションを表示しようとしています。ユーザーがフォームでオプションを選択するたびに、別のフォームが表示される必要があります。次のコードは、マウスを単一の非表示フォームの上に移動すると、そのように機能します。

$('id_35').hover(function(){

$('id_33').show();
});

ただし、フォーム35で実際のオプションが選択されているときに「id_33」を表示しようとしています。JSPページ内のフォーム35のHTMLは次のとおりです。

<li class="form-line" id="id_35">
<label class="form-label-left" id="label_35" for="input_35">
Available Start Dates<span class="form-required">*</span>
</label>
<div id="cid_35" class="form-input"><span class="form-sub-label-container">
<select class="form-  dropdown validate[required]" style="width:500px" id="input_35" name="q35_availableStart"> <option value="">Please Select</option>  

<%
int evar = 0;
String[] xvar = rslt2.split(";") 
while (evar < StartDates.length) {
xvar = StartDates[evar].split(";");
out.println("<option value=\""+xvar[0]+"\">"+xvar[0]+"</option>");
evar++;
}
out.println("</select>");

%>            
<label class="form-sub-label" for="input_35"> Choose from the Available Start Dates </label></span>`enter code here`
</div>
</li>
4

3 に答える 3

1

これを試して

$('#id_35').hover(function(){
  $('#id_33').show();
});
于 2013-06-27T17:52:45.510 に答える
0

そのための変更イベントを書くことができますselect

$("#input_35").change(function() {

    //If you want to show the form when a specific value has been selected
    var selectedValue = this.value;
    if (selectedValue == "condition_here") {
        $("#id_33").show();
    }
});
于 2013-06-27T17:52:33.853 に答える
0

これを試してください:(最初にチェックボックスを付けて編集した投稿で作成し、両方checkboxまたはを受け入れるようになりましたoption

$(document).on("change", ".show", function (event) {
    if (this.checked == true || this.value == "show") // Checkbox or Option
        $("#f2").show();
    else 
        $("#f2").hide();
});

フィドル

于 2013-06-27T19:37:25.047 に答える