📌  相关文章
📜  如何使用 jquery 中的输入名称从选择选项中获取值 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:01.748000             🧑  作者: Mango

代码示例3
document.getElementById('prod_addcart21').addEventListener('click', function () {
        if ($('select[name="variation[1]"]').val() == '') {
                alert('Please, choose an option 1');
            return false;
        } else if ($('select[name="variation[2]"]').val() == '') {
    
            alert('Please, choose an option 2');



        } else if ($('select[name="variation[3]"]').val() == '') {

            alert('Please, choose an option 3');


        } else {
            alert("product added to cart")
        }
    

    });