<form action="" method="POST">
Quantity1: <input type="text" name="quantity1" id="quantity1">
Product1: <select name="product1" id="product1"><option value="1">Product 1</option><option value="2">Product 2</option> ... <option value="15">Product 15</option></select>
Price1: <input type="text" name="price1" id="price1">
Quantity2: <input type="text" name="quantity2" id="quantity2">
Product2: <select name="product1" id="product2"><option value="1">Product 1</option><option value="2">Product 2</option> ... <option value="15">Product 15</option></select>
Price2: <input type="text" name="price2" id="price2">
.
.
.
Quantity15: <input type="text" name="quantity15" id="quantity15">
Product15: <select name="product15" id="product15"><option value="1">Product 1</option><option value="2">Product 2</option> ... <option value="15">Product 15</option></select>
Price15: <input type="text" name="price15" id="price15">
<input type="submit" value="submit">
</form>
나는 제품이 이미 다음이 선택하는 사용자에게 경고를 선택하면 확인 할 형태를 가지고있다. 내가이 http://jsfiddle.net/GKTYE/ 같은
$('select[id^="product"]').change(function() {
//empty array
var selected_values = array();
//check value if it is in array then alert
if ($(this).val() IS IN ARRAY) {
var product = $(this).text();
alert("you have already select this"+product);
} else {
// else save it in array
selected_values[] = $(this).val();
}
}
뭔가를 생각하지만,에,이 경고는 내가 선택 변화되고 싶어 제출 그것은이 같은해야한다. 도와주세요!
jQuery 코드를 게시하는 것을 잊었습니다 ... – elclanrs
자바 스크립트 부분은 어디에 있습니까? – djakapm
언제 사용자에게 알리고 싶습니까? 제출하기 전이나 후에 히트하기 전에? – Popnoodles