I want to get label of element as string and alert that string in jquery. I wrote code below but i get [object][Object] value. I tried html() and text() too but it didnt work.
function seatObject(id, label, status, token){
this.id = id;
this.label = label;
this.status = status;
this.token = token;
}
for (var x = 0; x < 5; x++) {
var temp = new seatObject("#" + x, "label" + x, "available", "");
seats[x] = temp;
$("#" + x).click(function () {
currentSeat = $(this).attr("id");
var label = $("label[for="+$(this).attr('id')+"]");
alert(label);
});
}
Also this is my tag;
<rect style="fill: #888888;" id="0" width="35.823246" height="35.823246" x="299.87155" y="65.999405" class="seatObj" label="A24"></rect>