0

I have the following code and it works fine in all browsers:

 <input type="text" id="fileUploadTextBox" value="Browse My Computer"/>

When it comes to IE I wanted to change the text slightly to

 <input type="text" id="fileUploadTextBox" value="Browse My Computer (Double Click)"/>

Can I do this using CSS? I know how to run a separate CSS file for IE.

Or is there another way to do this?

thx

3
  • I think do that only with CSS inpossible You can use that jQuery code if ($.browser.msie) { $('#fileUploadTextBox').val('Browse My Computer (Double Click)') }
    – yAnTar
    Commented Jul 26, 2012 at 7:02
  • I think it has nothing to do with CSS?? Commented Jul 26, 2012 at 7:02
  • ok... understand... I thought it might be possible... thankyou for taking the time to explain this to me... :)
    – Adam
    Commented Jul 26, 2012 at 7:04

2 Answers 2

4

By using conditional comments you can do this:

For Other Browsers:

<!--[if !IE]><!-->
    <input type="text" id="fileUploadTextBox" value="Browse My Computer"/>
<!--<![endif]-->

For IE Browsers:

<!--[if IE]>
    <input type="text" id="fileUploadTextBox" value="Browse My Computer (Double Click)"/>
<![endif]-->

SEE DEMO

Or you can use Javascript/jQuery to achieve it.

1
  • perfect - thankyou... will tick the tick with the time limit passes... thx again!
    – Adam
    Commented Jul 26, 2012 at 7:11
-1

This Javascript with jQuery should work:

if ( $.browser.msie ) {
  <input type="text" id="fileUploadTextBox" value="Browse My Computer (Double Click)"/>
} else {
  <input type="text" id="fileUploadTextBox" value="Browse My Computer"/>
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.