Guest User

Untitled

a guest
Aug 14th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. Insert HTML line breaks in jQuery?
  2. function submit_post(){
  3. var post = $('#textarea').val();
  4. $.('post', { post: post }, function(result){
  5. //if PHP returns an error do something
  6. else{
  7. $('#divname').prepend(result);
  8. }
  9.  
  10. //PHP processes the user's post
  11. $post = nl2br(stripslashes($post));
  12. //print html formats the post
  13. echo $post;
  14. //html ends
  15.  
  16. while(string.search("n")) {
  17. string.replace("n", "<br>");
  18. }
Add Comment
Please, Sign In to add comment