Title: P tag in javascript.
Last modified: August 22, 2016

---

# P tag in javascript.

 *  Resolved [akamenov](https://wordpress.org/support/users/akamenov/)
 * (@akamenov)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/string-in-javascript/)
 * Hello, I’ve been successfully using wp-d3 for a while now. Today I ran into the
   following problem: if js code contains symbols <p>, WordPress inserts a newline
   character before them, making code invalid.
    For example, if I write `node.html("
   <p>" + text + "</p>")` the newline is inserted right after the first quote character.
   I don’t really know if the problem is in wp-d3 or in WordPress itself, but it
   would be great if you could suggest a way to make this work.
 * [https://wordpress.org/plugins/wp-d3/](https://wordpress.org/plugins/wp-d3/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [akamenov](https://wordpress.org/support/users/akamenov/)
 * (@akamenov)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/string-in-javascript/#post-5801265)
 * Update: I’ve managed to fix this problem in my development environment. The extra
   line breaks are introduced by the wpautop filter, so removing the two lines that
   change its priority in wp-d3.php fixes the issue. Still, I would prefer not to
   modify anything myself on the actual website, so it would be really great if 
   the bug was fixed.
 *  Plugin Author [Ruben](https://wordpress.org/support/users/figurebelow/)
 * (@figurebelow)
 * [11 years ago](https://wordpress.org/support/topic/string-in-javascript/#post-5801457)
 * Hi,
 * The plugin version 2.2 should fix this.
 * R.
 *  Thread Starter [akamenov](https://wordpress.org/support/users/akamenov/)
 * (@akamenov)
 * [11 years ago](https://wordpress.org/support/topic/string-in-javascript/#post-5801475)
 * Thanks for the update! I saw it didn’t work for me, but only now have I found
   a time to look into it.
    So, the issue is not only with <p> tag, but with any
   block tags (they are listed in $allblocks variable in the wpautop source). And
   the issue is actually the WordPress issue, not yours – including a simple
 *     ```
       <script>
       alert('<div> This is sample HTML </div>');
       </script>
       ```
   
 * in the text view breaks the post.
    So, there’s probably not much to be done on
   your part (except for the solution I outlined above, but it may break other things,
   I suppose). I’ll try to reach out to the WP devs.
 *  Plugin Author [Ruben](https://wordpress.org/support/users/figurebelow/)
 * (@figurebelow)
 * [11 years ago](https://wordpress.org/support/topic/string-in-javascript/#post-5801479)
 * Hi,
 * The wpauto WordPress feature is tricky, imho it’s better to not mess with it.
   
   Disable it and you may find old posts without newline breaks and so. Enable it
   after a while and you may see double empty lines around the posts.
 * The thread regarding wpauto in the forums worth a reading 🙂
    Thanks for tracking
   the issue.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘P tag in javascript.’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-d3_bda39b.svg)
 * [Wp-D3](https://wordpress.org/plugins/wp-d3/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-d3/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-d3/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-d3/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-d3/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-d3/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [newline](https://wordpress.org/support/topic-tag/newline/)

 * 4 replies
 * 2 participants
 * Last reply from: [Ruben](https://wordpress.org/support/users/figurebelow/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/string-in-javascript/#post-5801479)
 * Status: resolved