それぞれの横に開く/閉じるボタンがあるアイテムのリストがあります。開く/閉じるボタンを切り替えたいのですが。これは、ボタンが最初に選択されたときに機能しているように見えますが、2回目にボタンが選択されたときに機能が開始されません。誰もが理由を知っていますか?
//update status - close
$("#close_<?=$order_id?>").click(function(){
alert('close');
order_update_type = 'updatestatus';
order_status = '2';
order_selected.set("status", order_status);
$("#close_<?=$order_id?>").replaceWith('<a data-align="left" class="km-button" data-role="button" id="open_<?=$order_id?>" style="float:left; margin:5px;"><span class="km-text">Re-open</span></a>');
});
//update status - re-open
$("#open_<?=$order_id?>").click(function(){
alert('open');
order_update_type = 'updatestatus';
order_status = '1';
$("#open_<?=$order_id?>").replaceWith('<a data-align="left" class="km-button" data-role="button" id="close_<?=$order_id?>" style="float:left; margin:5px;"><span class="km-text">Close</span></a>');
});