Leaves space in input field
I have a problem. I don't want to leave blanks in input as shown below:
Display from Input element:
Should be -> |Mickey|
Comes up -> |Mickey |
Which leaves some trailing blank.
Sample code below:
var txt="Size=" + document.getElementById("name").size;
var txt=txt + " and Max length=" + document.getElementById("name").maxLength;
Name: <input type="text" id="name" value="Mickey" size="6" maxlength="6" />
<br /><br />
<input type="button" onclick="maxLen()" value="Alert size and maxLength" />
""Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
" -- Sir Winston Churchill
That code wouldn't work. Let's say if I have "Mickey Mouse" and JS returns "MickeyMouse" which removes all blanks.
This is what I want:
Now shows: |Mickey.....| ...... are blanks (about 5 blanks).
Should be " |Mickey| size=6, maxlength=6.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)