Here is my code on jsFiddle where I am dynamically changing the text font to fit in the div. Everything is working perfectly fine. Currently, the text is within a span element, but I would like to remove the span and have the same functionality. However, when I remove the span, the code stops working. I even modified the function from:
var ourText = $('span:visible:first', this);
to
var ourText = $(targetid, this);
I tried using it as follows:
<h1 id="h1" class='jtextfill'>
Sample
</h1>
<h2 id="h2" class='jtextfill2' >
aaSamp sfd sdfsf sfsddffds ss ssf fsdf sdf sfs fsdfs sdfsdf sdf sdfsfsfsdfsdfsf sdf sfsf sfs sf sf sd sfsf sfsdsfd sfdfdf a ada adf ad adasda a adsa s sfzz
</h2>
Unfortunately, it did not work as expected.