I’m using the following:
el = doc.createElement("input");
el.size = "2%";
I get the error message (in Firebug): Index or size is negative or greater than the allowed amount.
It was working fine when I just injected the HTML rather than built the DOM properly, as below:
$rsc.html("<input name = 'myName' type = 'text' value = '" + myVariable + "' size = '2%' />");
Why is it not accepting the 2% with createElement?
Thanks
The
sizeattribute accepts only integers, not percents. It represents the maximum number of allowed chars to be typed in the input.If you put that in your HTML, probably the % is ignored and the value is parsed as 2.
If you need to adjust the width of the input, then you can use
style='width:2%'.