简要解释我的程序:
我有 3 个选择框
如果用户在第一个框中选择的值是 2,并且用户在第二个框中选择的值是 3(选项值),则第三个选择框应显示一个数组。
此代码不起作用,但显示了一个想法:
if ($('#firstbox').click(function() { ($(this).val() == '2'); } &&
$('#secondbox').click(function() { ($(this).val() == '3'); }) {
// Array Display here (not included the coding here, because there is no issue with this coding.. seems working fine)
}
我需要 if 语句中包含的代码以及用于检查表达式的 && 操作的帮助。
最佳答案
var select1 = $('#firstbox');
var select2 = $('#secondbox');
$([select1, select2]).change(function () {
if ( select1.val() == 2 && select2.val() == 3 ) {
// run your code here...
}
});
关于javascript - 两个选择框的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14819195/