iOS select onchange not firing

后端 未结 3 405
甜味超标
甜味超标 2020-12-02 19:09

Does anyone know any workarounds for this? I\'m trying to use a select element for navigation. It looks something like this;


                        
    
提交评论

  • 2020-12-02 19:46

    If you change onchange to onblur it works for iOS but not others. The fix I eventually came to was to use BOTH onblur and onchange. Seems redundant but has the desired effect.

    0 讨论(0)
  • 2020-12-02 19:57

    iOS tends to not fire change events when you change the value of their inputs. I've documented this in more depth at the Device-Bugs tracker.

    The workaround is to bind to the blur event instead. In the above example, use onblur and you'll be all set.

    <select onblur="window.location=(this.options[this.selectedIndex].value)">
    
    0 讨论(0)
  • 提交回复
    热议问题