.click(); problems on FF

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tader
    New Member
    • Sep 2007
    • 43

    .click(); problems on FF

    here is my script

    [HTML]<input type="button" value="file" onclick="docume nt.getElementBy Id('file').clic k()">
    <input type="file" style="display: none" id="file" onchange="alert (this.value)"> [/HTML]

    and this i my problem
    this script works on IE but it don't works on FF can anyone tell me how to make it work on FF too?
    Last edited by gits; Sep 29 '07, 09:40 AM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    hi ...

    could you please explain what you want to achieve with that? you click on a button and you want to call the click event of a file-type input box? ... why not using its own button?

    kind regards

    Comment

    • phvfl
      Recognized Expert New Member
      • Aug 2007
      • 173

      #3
      Hi,

      A file input element does not have a click function according to web standards, there is no problem with Firefox, IE is executing invalid javascript. If you are trying to focus on the file input use the .focus() function instead, if you are trying to select it use the .select() function.

      A reference for the file intput pbject can be seen on w3schools here

      Comment

      • tader
        New Member
        • Sep 2007
        • 43

        #4
        am not using the file button because it seas browse... i need the other word in it! and none of these aren't working for me focus(), select() maybe i don't know how to them right can you write me how to do it?

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Maybe you could try styling the element as shown here.

          Comment

          Working...