アプリはhtmlダイブを受け取り、ページを作成してアプリに追加します
ページのセット内のすべてのリンク ボタンを、ページの ID に応じて異なるタスクを実行する 1 つの関数にバインドします。ページに複数のリンク ボタンがある場合に問題が発生します。クリックされたボタンの ID が必要です。
HTML:
<a id="x">x </a>
<a id="y">y </a>
J:
var btns = [];
$('#page-' + newpages[j].pageID + ' a').each(function () {
btns.push({
id: this.id,
value: this.value,
name: this.name
});
});
for (i in btns) {
$('#' + btns[i].id).bind('click', function () {
test(btns[i].id)
});
// bin all buttons in current page to test()
}
};
};
function test(x) {
var page = $('.ui-page-active').attr('id');
/////////
//here I'm trying to ge the ID of clicked button of that page (each ID means something)
var pos = '';
$('#' + page + ' a').click(function () {
//Get the id of this clicked item
var BID = $(this).attr("id");
alert(BID);
send(BID);
});