我將如何爲此語句添加另一個不等於(!=)的值?我將如何添加另一個不等於(!=)這個陳述?
if ($(this).data("increase_priority1") && $(this).val() != 1)
我試圖反轉在其確定其是否等於所述函數的開頭的語法,但是從完全除去物品(包括那些不等於1)停止它
if ($(this).data("increase_priority1") && $(this).val() != 1 && $(".complaint select").val() != "Too_small")
該函數添加和/或在用戶選擇投訴並將問題的重要性級別進行排名時從「increase_priority1」中刪除值,並且我需要它來更改該值(在這種情況下投訴是什麼)和重要性級別(即increase_priority1)如果這兩個字段中的任何一個發生變化目前只有在重要性水平發生變化時纔會發生變化。
完整的功能是:
var $increase_priority1 = $(".increase_priority1");
$('.ranking, .complaint select').dropkick({
change: function() {
var name = $(this)
.data("name"); //get priority name
if ($(".complaint select")
.val() === "Too_small" && $(this)
.val() == 1 && !$(this)
.data("increase_priority1")) {
//rank is 1, and not yet added to priority list
$("<option>", {
text: name,
val: name
})
.appendTo($increase_priority1);
$(this)
.data("increase_priority1", true); //flag as a priority item
}
if ($(this)
.data("increase_priority1") && $(this)
.val() != 1) {
//is in priority list, but now demoted
$("option[value=" + name + "]", $increase_priority1)
.remove();
$(this)
.removeData("increase_priority1"); //no longer a priority item
}
}
});
小提琴這表明這一背景下:http://jsfiddle.net/chayacooper/vWLEn/132/
我不明白這個問題... – 0x499602D2
你可能是想刪除元素爲$(this).val()!= 1 ** **或**'$(「.indusselect」) .val()!=「Too_small」'? – Kninnug
@Kninnug當這些語句中的任何一個不正確時,我需要刪除元素。這是一個OR語句而不是AND? –