I want to echo the following html code on my page. But the onclick event doesn't work when I do this. the $senduser has the correct value
$table1="<div id='sendmsg' class='row'>
<div class='col-lg-6'>
<textarea id='msg' cols='40' placeholder='Write your message here...'></textarea>
</div><div class='col-lg-2' >
<button type='button' onClick='sendmsg(".$senduser.")' class='btn btn-success' value='send' id='msgbtn'>Send to</button></div></div>";
echo $table1;
my javascript function:
function sendmsg(senduser){
alert(senduser);
.
.
.
}
Alert doesn't show anything.