This topic is locked

Getting the custom button ID generated on

8/22/2021 4:00:43 PM
PHPRunner General questions
L
Lance Spurgeon author

I have 2 static button in the header of a list page one for delete and the other custom button to archive a record. The archive button has a "client before" = "swal" and "server action". The id of this button keeps changing example:
<span data-itemtype="custom_button" data-itemid="archive_selected" data-pageid="1" data-page="todoboards_list" data-small="" data-button-item=""><a type="button" title="" class="btn-link " id="Archive_25" href="javascript:void(0)" typeid="ib">Archive</a></span>

when call the id from the page id the code doesn't work $("#Archive_"+pageid).click(); when I put $("#Archive_25).click(); it works. Can you tell me what am I missing here?

`$(".panel-default").each(function(){
if($(this).find("[id^=delete_board]").length>0){
var id = $(this).find("[id^=delete_board]").attr("boardid");
$(this).click(function(ev){
if($(ev.target).attr("boardid")==undefined)
location.href="todoboards_edit.php?editid1="+id;
});
}
$(this).mouseover(function(){
var id = $(this).find("[id^=delete_board]").attr("boardid");
$("#deleteboard"+id).css("display","");
$("#deleteboard"+id).unbind().bind("click",function(event){
event.stopPropagation();
$("input[value="+id+"]").attr('checked', true);
$("#delete_selected"+pageid).click();
swal("Your campaign has been deleted with related details!");
});
});
$(this).mouseout(function(){
var id = $(this).find("[id^=delete_board]").attr("boardid");
$("#deleteboard"+id).css("display","none");
});

$(this).mouseover(function(){
var id = $(this).find("[id^=archive_board]").attr("boardid");
$("#archive_board_"+id).css("display","");
$("#archive_board_"+id).unbind().bind("click",function(event){
event.stopPropagation();
$("input[value="+id+"]").attr('checked', true);
$("#Archive_21").click();
//$("#Archive_"+pageid).click();
});
});
$(this).mouseout(function(){
var id = $(this).find("[id^=archive_board]").attr("boardid");
$("#archive_board_"+id).css("display","none");
});

});`