Reputation: 148
I have created a js (with jQuery) to change the size of the text inside a textarea by changing the css. pressing a button the next JavaScript is called:
$("#id").css("font-size",fontsize + "px");
And it's working. but with internet explorer (at least the version 9), the text goes outside the bounds of the Textarea, but if I edit the text, it automatically is arranged.
Example:
Text before changing the size
Text after changing the size. This is only happening with IE
Text after edit the textarea. This is the result that a get in Chrome, but for IE this only happen after edit it
For me, that's a glitch, is there any workaround to fix it?
Upvotes: 0
Views: 332
Reputation: 2643
I think this should work for you :
var value=$("#id").value();
$("#id").css("font-size",fontsize + "px").replaceWith( $("#id").clone().val(value) );
All I am doing is re-inserting the element in the DOM. I think this is the only way to solve this annoying bug.
Happy coding!
Upvotes: 1