简体   繁体   中英

how to change onclick function with double quote in variable

$status="<div  class='analysis btn btn-secondary' ><a id='$poupid' href='javascript: void 0;' onclick='open_windowdata(this.href,this.id)' style='color:white'><strong>Not attempted</strong></a></div>";

just need to replace onclick with below code

onclick="$('#wiewans_<?php echo $slno; ?>').slideToggle('slow')"

facing with trouble quote any one help us thanks

用'\\'转义双引号,这样它们就不会被解析为字符串的结尾:

$status = "<div class='analysis btn btn-secondary'><a id='$poupid' href='javascript: void 0;' onclick=\"$('#wiewans_<?php echo $slno; ?>').slideToggle('slow');\" style='color:white'><strong>Not attempted</strong></a></div>";

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