Reputation: 3166
$t="<table>
<tr>
<td >
<a href='#' onClick='alert('some text!');' >
</td>
</tr>
<table>";
echo $t;
any inline javascript didn't work so I inspect the a element in browser and turns out its like:
<a href="#" onClick="alert("some text');'>
What am I doing wrong with quotation marks?
Upvotes: 0
Views: 181
Reputation: 6023
You got wrong quotes. Try this:
<a href='#' onclick=\"alert('some text!');\">
Upvotes: 0
Reputation: 2129
<?php
$t="<table>
<tr>
<td >
<a href='#' onClick=\"alert('some text!');\" >test</a>
</td>
</tr>
<table>";
echo $t;
?>
Upvotes: 1
Reputation: 15603
<a href='#' onClick=\"alert('some text!');\">
Use this code this will work fine.
Upvotes: 0
Reputation:
use:
$t=<<<EOT
<table>
<tr>
<td >
<a href='#' onClick='alert("some text!");' >
</td>
</tr>
<table>
EOT;
or
$t="
<table>
<tr>
<td >
<a href='#' onClick='alert(\"some text!\");' >
</td>
</tr>
<table>
";
echo $t;
Upvotes: 3