1

We're using jHtmlArea in our site for the html input elements. I've noticed in our implementation adding a newline generates a new div tag wrapping a br tag. Adding text to the line removes the br tag with resulting html renders with no breaks.

On the example provided here: https://pietschsoft.com/Demo/jHtmlArea/Default.htm

Adding a line creates a paragraph tag rather than a div+br. Has anyone seen something similar where it's required to add two lines in order to get a line break?

Some thoughts on next steps to debug this issue or just get used to the two-line method?

Edit:

Relevant jsfiddle - https://jsfiddle.net/xrtaw4k8/1/

<script type="text/javascript" src="https://pietschsoft.com/Demo/jHtmlArea/scripts/jHtmlArea-0.8.alpha.min.js"></script>
<script type="text/javascript" src="https://pietschsoft.com/Demo/jHtmlArea/scripts/jHtmlArea.ColorPickerMenu-0.8.alpha.min.js"></script>
<!--http://rs.01298.com/rs/lib/js/jHtmlArea-0.8.min.js-->
<link rel="stylesheet" href="https://pietschsoft.com/Demo/jHtmlArea/content/jHtmlArea/jHtmlArea.ColorPickerMenu.css">
<link rel="stylesheet" href="https://pietschsoft.com/Demo/jHtmlArea/content/jHtmlArea/jHtmlArea.css">
<link rel="stylesheet" href="https://pietschsoft.com/Demo/jHtmlArea/content/bootstrap/bootstrap.min.css">

<div>
  <textarea cols=90 rows=50></textarea>
</div>

Script:

$('document').ready(function() {
    $('textarea').htmlarea();
});

2 Answers2

0

jHtmlArea uses a feature in the browser to make an element editable. As a result, the HTML generated is actually generated by the web browser, and different web browsers may generate slightly different HTML.

Chris Pietschmann
  • 29,502
  • 35
  • 121
  • 166
  • I'm using the same browser when visiting the example I listed, that one produces the

    tags.. however my jsfiddle which uses the exact same sources produces the


    tags. Same browser two different implementations with the two different results.
    – Ryan Williams Oct 20 '20 at 16:08
0

So I discovered the reason why one is producing paragraph tags the other div tags.. apparently if the text area is seeded with

tags then each new line will be surrounded with p tags as well? As Chris mentioned above it's a quirk of Chrome and not anything the library is doing.