Gajendra
Gajendra

Reputation: 37

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

Upvotes: 0

Views: 93

Answers (1)

Alfons McBobr
Alfons McBobr

Reputation: 99

Escape the double quotes with ' \ ', this way they wont get parsed as end of the string :

$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>";

Upvotes: 1

Related Questions