javascript - onclick() parameter becomes object Object -


i have following function:

'countyofflinenote': function (county) {     console.log(county);     console.log('logged county');     var = '';     = '...more logic...';       var message = '...some logic...';       var title = 'create offline county note ' + county.county;     $('body').appmodal({         appliedto: '',         title: title,         type: '',         message: 'please enter note current county status',         submessage: '',         template: 'simple',         contents: message,         cancel: "<input type='button' value='cancel' class='button action left cancel' onclick='$ep.modules.appmodal.cancel(\"" + county "\");' />",         icon: 'info',         callback: ''     });      $('#support-question').focus(); } 

the issue having input html. when pass county cancel() function, end seeing [object object] in console. how need change way i'm passing parameter?

here cancel() function:

'cancel': function (county) {      county.isoffline = !county.isoffline;     $ep.modules.appmodal.close(); } 

if $('body').appmodal({...}) code adding element dom can 1) remove onclick handler input html in cancel property, 2) add input html id inputid, , attach event handler after element appended dom - place code below $('body').appmodal({...}):

$('#inputid').click( function(county) {     county.isoffline = !county.isoffline;     $ep.modules.appmodal.close(); }) 

or rather:

$('#inputid').click( function() {     county.cancel(); }) 

and add cancel method county object:

cancel = function() {     this.isoffline = !this.isoffline;     $ep.modules.appmodal.close(); } 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -