I have two <textField>
one by one. Is possible to automatically stretch or shrink them depending on text length? The only attribute which hit my eyes, was the isStretchWithOverflow
but cause that one text is covering another - that is not what I meant. Anybody helps? Is it even possible?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I assume you are talking about stretch vertically.
In that case isStretchWithOverflow
is exactly what you need.
The second <textfield>
covered by first one is because the position setting. You probably has it setting to Fix
, so it dose not move while first one stretched. Change the position setting of second <textfield>
to Float
should works.
回答2:
I don't believe this is possible using pure HTML/CSS. However, you could do it by using Javascript. One way would be to bind a keypress event handler to your input which updates its width.
If you use JQuery, something like:
$(yourInput).keypress(function(){
$(this).css("width", $(this).val().length * 5);
});
should do the trick (although you'll probably want to adjust the calculation; I have no idea if 5px per character is too much or too little).
标签:
jasper-reports