Note that there are some explanatory texts on larger screens.

plurals
  1. POJustification in textArea with variable fontSize
    primarykey
    data
    text
    <p>I have a text area which is editable. When we enter text in the textArea, the font size of the text change with the change in the text length. The greater the text length, smaller the font-size. This causes problems in the justification, is there any way I can justify the text inside the text area.</p> <p><strong>Here is the Javascript Code:</strong></p> <pre><code>var textie = document.getElementById('new1'); var spanny = document.getElementById('length'); var textLength; textie.addEventListener('keypress',function(e){ var size; textLength = textie.value.length; size = Change(textLength); this.style.fontSize = size; },false); function Change(fontLength) { var fontSize; if(fontLength&gt;=1 &amp;&amp; fontLength&lt;=4) { fontSize = 35+"px"; } else if(fontLength&gt;=5 &amp;&amp; fontLength&lt;=12) { fontSize = 30+"px"; } else if(fontLength&gt;=13 &amp;&amp; fontLength&lt;=35) { fontSize = 20+"px"; } else if(fontLength&gt;=36 &amp;&amp; fontLength&lt;=50) { fontSize = 18+"px"; } else if(fontLength&gt;=51 &amp;&amp; fontLength&lt;=150) { fontSize = 16+"px"; } else if(fontLength&gt;150) { fontSize = 15+"px"; } return fontSize; } </code></pre> <p><strong>Here is the HTML</strong></p> <pre><code>&lt;textArea class = "new" id = "new1"&gt;&lt;/textArea&gt; &lt;span id = "length"&gt;&lt;/span&gt; </code></pre> <p><a href="http://jsfiddle.net/ankit90/u69sX/" rel="nofollow">I am attaching a jsfiddle, try adding (lots of)random text in it and you will understand</a></p> <p>thanks!!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload