在選擇框值的語句我有一個指向選擇框PHP頁面上寫在JavaScript中function
問題。這if語句是指選擇框如果在一個javascript函數
if (!(document.getElementById("add_product").value)==="Choose here")
下面的代碼:
function promptEnrollmentMonth() {
if (!(document.getElementById("add_product").value)==="Choose here") {
var month = prompt("Is this the correct month for this course/product?", "<?php echo "$EnrollmentMonth"; ?>");
if (month !=null) {
}
}
}
<button type="submit"
onclick="promptEnrollmentMonth()">Update</button>
<div>Add course/product:<select name='add_product'>
<option selected>Choose here</option>
<option>Other options...</option>
</select></div>
如果(的document.getElementById( 「add_product」)。值!== 「這裏選擇」) – Conceptz