我的网站上有一个预订表格,如果我选择 10 人以上,那么展位的表格选项就会消失,因为他们最多只能容纳 9 人。这一切正常,这是我的脚本:
$(document).ready(function(){
$('#form1_people').on('change',function(){
if( $(this).val()==="10+ People"){
$("#tenplus").hide()
$("#booth-notice").show()
}
else{
$("#tenplus").show()
$("#booth-notice").hide()
}
});
});
我的问题是在主页上我有一个快速预订表格,当用户填写它并自动更新大表格时。但是,如果我从主页中选择 10 多个人,则 JavaScript 不会执行。
我以为我需要在每个页面上都有这个 JavaScript?我试过这个,但它不起作用。我没主意了。任何人?
谢谢
更新!!!!
<div>
<label for="form1_people">How many people:</label>
<select id="form1_people" name="people" class="venue-select">
<option value="Select how many people">Select how many people</option>
<option value="2 People">2 People</option>
<option value="3 People">3 People</option>
<option value="4 People">4 People</option>
<option value="5 People">5 People</option>
<option value="6 People">6 People</option>
<option value="7 People">7 People</option>
<option value="8 People">8 People</option>
<option value="9 People">9 People</option>
<option value="10 People">10 People</option>
<option value="10+ People">10+ People</option>
</select>
</div>
<div id="booth-notice" style="display:none;">
<label style="color: #ed1c24!important; font-size: 16px!important; line-height: 1.4em!important;"><em style="color: #ed1c24!important;">Customer Notice * Booths are not available for parties with more than 10 people</em></label>
</div>
<div id="tenplus"><!-- HIDE THESE IF THERE IS MORE THAN 10 PEOPLE -->
<div>
<label for="form1_booth">Would you like a Booth: <em>*Liverpool & Manchester Only</em> <a href="#">What's this?</a></label>
<select id="form1_booth" name="booth" class="venue-select">
<option value="Please select an option">Please select an option</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</div>
<div>
<label for="form1_booth-package">We have some Booth Packages <a href="#">What's this?</a></label>
<select id="form1_booth-package" name="booth-package" class="venue-select">
<option value="Select an option if wanting a booth">Select an option if wanting a booth</option>
<option value="Bier Package">Bier Package</option>
<option value="Cocktail Package">Cocktail Package</option>
<option value="Just a booth please">Just a booth please</option>
</select>
</div>
</div><!-- HIDE THESE IF THERE IS MORE THAN 10 PEOPLE -->