Why does the jquery gets disabled when I print data with line breaks from mysql? The problem here is that all the functions in javascript and js are disabled and wasn't able to do their task
For example from mysql I have this data:
You
are
good
in
english
and then I printed it like this:
<p id = "messagebody" style ="white-space:pre"> <?php echo htmlspecialchars($row['d_body']);?></p>
But when I have a data like this:
You are good in english
The jquery works! How come?
Any ideas?
UPDATE
I have this sample code here:
$mybody = "Hello
User";
also this one:
$mybody = "Hello \n User";
But both doesn't work!
But if it's:
$mybody = "Hello User";
It worked!
both are used by this;
<p id = "messagebody" style ="white-space:pre"> <?php echo $mybody;?></p>
Also have this button:
<button id = "<?php echo $rowcomment['comment_id']; ?>" class = "editcom"> Edit</button >
JQUERY:
$(document).on("click",".editcom",function(event){
var thisid = event.currentTarget.id;
alert(thisid);
});