Solved

Text Overflow Property (elipse) in IE6 Input Field

Posted on 2009-07-01
2
1,384 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

730 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