要素のラベルを文字列として取得し、その文字列を jquery で警告したいと考えています。以下のコードを書きましたが、[オブジェクト][オブジェクト]の値を取得します。html() と text() も試しましたが、うまくいきませんでした。
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);
});
}
これも私のタグです。
<rect style="fill: #888888;" id="0" width="35.823246" height="35.823246" x="299.87155" y="65.999405" class="seatObj" label="A24"></rect>