這是一個簡單的問題,但可能有人幫助我的JavaScript,它會顯示基於下拉選項是真格?僅當2個條件爲真時才顯示字段?
這是代碼我有,但我只是想知道這是否是正確的嗎?
編輯解決了以下兩個答案。非常感謝你們!
<script>
function myFunction(){
$('#LoadingPlace,#DeliveryPlaces').change(function() {
if ($('#DeliveryPlaces').val() == '1' ||
["Seaport 1", "Seaport 2", "Seaport 3"].indexOf($('#LoadingPlace').val()) > -1) {
$("{#ContainerSize1").show();
$("#ContainerFeature1").show();
\t \t $("#Genset1").show();
\t \t }
\t \t
\t else {
$("{#ContainerSize1").hide();
$("#ContainerFeature1").hide();
\t \t $("#Genset1").hide();
}
\t })};
</script>
是你''&&嘗試 – prasanth