onChange() event of input type select is not working in MAC safari

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HemalGati
    New Member
    • Jun 2007
    • 1

    onChange() event of input type select is not working in MAC safari

    hi friends,
    can anyone tell me why onchange() event input type select is not working in MAC safari. is there any alternative of this problem.

    i have written the following code :


    <Select name="adultcolo r" onChange ="CheckColor('a dultcolor');">
    //code is removed for simplicity.
    </SELECT>

    here when i am changing the combo(adultcolo r) value the checkcolor function is not called.

    please help me out for this problem

    thanks in advance
  • shoonya
    New Member
    • May 2007
    • 160

    #2
    use onclick

    shoonya

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5388

      #3
      hi ...

      im sure that onchange works with select-boxes in safari (i use it myself) ... try an alert instead of your checkfunction and change the value of the box ... that means ... select an other value as the one that is displayed first ... the alert should appear ... typically you have to write the handlers in lowercase ... try it ... i try it this evening too ... but i'm quite sure that it works ...

      kind regards ...

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        the following works in safari ...

        [HTML]<select onchange="alert (this.value);">
        <option value="1">1</option>
        <option value="2">2</option>
        </select>
        [/HTML]

        kind regards ...

        Comment

        • shoonya
          New Member
          • May 2007
          • 160

          #5
          but this code has a problem
          when you a select the default value then it wont give alert

          in this case if you click on drop down and select 1 it wont give ou an alert..

          shoonya

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            thats right ... the event is called onchange ... and so it fires on changing ;) typically we create an init method that calls everything that has to be initialized with a default value ... when using onclick the event fires without changing, thus call the handler when it is not needed ... but: you are right ... if you want it to be called everytime the user clicks the control ... you have to use onclick :: note: typically with ajax you do a request with the selected value ... and you needn't when you have the ui initialized and nothing is changing in an dropdown-list ... so avoid requests (and/or useless operations) wherever you can ... this is a rule of thumb ... so - there is no problem with the code ... its a question what purpose is to be achieved ... and: the question was about onchange with select in safari - and that works ...

            kind regards ...

            Comment

            Working...