Solved

Text Overflow Property (elipse) in IE6 Input Field

Posted on 2009-07-01
2
1,389 Views
Last Modified: 2013-12-08
I am trying to implement Text Overflow in an Input field and having no luck.  Using the code below

It does not work.  However the same exact tags work if I make type = "button", and the white-space/text-overflow/overflow combination creates the required ellipses in a DIV or a TD

Anyone able to point me in the right direction for a truncated text field (using IE 6) that will replace overflowed text with an ellipse?  
<input type = "text" id="Text2"  style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block; width: 145px; height: 25px;" />

Open in new window

0
Comment
Question by:thearniec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Murali Murugesan earned 300 total points
ID: 24760391
I dont think text-overflow property would be applicable for text box. Here is how u can acheive the same through javascript

<input type = "text" id="Text2"  style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block; width: 145px; height: 25px;" onkeydown="ellipsis(this.value,10);"/>

function ellipsis(txtValue,allowedwidth){
      var ellipsis_s = "...";
      if(txtValue.length == allowedwidth){
            document.getElementById('Text2').value = txtValue.substr(0,allowedwidth)+ ellipsis_s;
            document.getElementById('Text2').maxLength=txtValue.length;
      }else if(txtValue.length > allowedwidth +ellipsis_s.length){
            if(txtValue.substr(0,txtValue.length -1).length > allowedwidth){
                  document.getElementById('Text2').value = txtValue.substr(0,txtValue.length -1);
            }            
      }
}

-Murali*
0
 
LVL 12

Assisted Solution

by:Chad Haney
Chad Haney earned 200 total points
ID: 24790692
There is no attribute to set this for an input box, using javascript is going to be your only option in this case.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question