$(document).ready(function(){ $('.cancer_help_btn').append(''); $('.cancer_help_btn').off("click").on('click',function(){ var modal_head = ""; try{ modal_head = $(this).parent().find(">label").html()}catch{}; var modal_body = ""; try{ modal_body = $(this).parent().find(">input.help_texts").attr('value')}catch{}; $('#show_help_modal').html("") $('#show_help_modal').modal('show'); $('#show_help_modal .close').off("click").on('click',function(){ $('#show_help_modal').modal('hide'); }); $('#show_help_modal .modal-footer button').off("click").on('click',function(){ $('#show_help_modal').modal('hide'); }); }); });