如何使用具有两个属性的元素作为标识符?我在这里得到了这个带有id和名称标识符的tr元素。
<tr class="danger" id="event_row" name="'.$result["id"].'" data-tooltip="#popupboxm">
我想将它用于此事件:
$(document).on('click', '#evnt_can', function() {
var item = this;
var table_row = //the two-identifier element will be use in this variable.
var option1Value = $(this).data("value");
var option2Value = $(this).data("status");
$.ajax({
async: false,
url : "models/ajaxReq/req_evntcan.php",
type : 'POST',
data : {option1Value, option2Value},
dataType: "text",
success : function () {
if (option1Value == 0){
$(table_row).attr("class", "danger");
$(item).html("Cancel Event");
}
else if (option1Value == 1){
$(table_row).attr("class", "info");
$(item).html("Reassign Event");
}
},
error : function () {
console.log(xhr.responseText);
}
});
});`
答案 0 :(得分:0)
好吧,我认为你可以使用自定义属性来合并它们,然后使用自定义属性作为标识符