I would like to dynamically generate text fields using jQuery Mobile with different number of lines. I was going to use a knockout for this, bind data to the rows attribute.
eg. here: http://jsfiddle.net/j7b9A/2/
<label for="textarea-1">5 rows:</label> <textarea rows="5" name="textarea-1" id="textarea-1"></textarea> <label for="textarea-2">10 rows:</label> <textarea rows="10" name="textarea-2" id="textarea-2"></textarea>
However, JQuery Mobile ignores the rows attribute, which is well-documented: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea and is even included in JQuery Mobile's own documentation: http: //view.jquerymobile .com / 1.3.1 / dist / demos / widgets / textinputs / index.html # Textarea .
The comment here states that setting the height and width overrides the rows attribute: https://stackoverflow.com/a/416829/ This seems to be due to the fact that jQuery Mobile performs the transition when the text area expands. So, is the rows attribute always completely overridden?
Another similar question is here: How to make a 10-line text area fixed? but that doesnβt help me since I donβt want to fix the height of all text areas, I would like them to change as they usually can use the rows attribute.
I also noticed that I canβt explain that in my own code a scammer style="height: 184px;" added to one of my text fields but not another. The other simply uses the standard 50px style, as indicated in this answer: jQuery Mobile and lines in the text area - this seems to indicate that something else is happening, but I cannot reproduce it in a simple fiddle.
I quickly looked at the source of jQuery Mobile, but donβt see that the rows attribute is used at all?
What would be the best way to specify a range of line heights for a range of related jQuery Mobile text fields?
source share