Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Text Overflow Property (elipse) in IE6 Input Field

Posted on 2009-07-01
2
Medium Priority
?
1,414 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 1200 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 800 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
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)

604 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