简体   繁体   中英

confirmation message is not firing a href onclick

below is only a part of my javascript code. confirmation message is not firing.

 function PKId_delete_formatter(cellvalue, options, rowObject) {
    return '<a href="JqGridClients/Delete?id=' + cellvalue + '" onclick="return confirm("Are you sure want to delete?");" class="ui-icon ui-icon-trash"></a>';
}

I think the above code is enough, please let me know if more code is needed

Use this:

return '<a href="JqGridClients/Delete?id=' + cellvalue + '" onclick="return confirm(\'Are you sure want to delete?\');" class="ui-icon ui-icon-trash"></a>';

It inserts the proper quotes for the confirm .

DEMO: http://jsfiddle.net/BS5u6/1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM