views:

119

answers:

2

In a web application I'm working on, I decided to consolidate a few buttons by turning them into select elements of one dropdown list, with onClick events loading for each option pressed. However, this does not work in iOS (Safari on the iPhone). Is there a different event I can use to grab menu selection from Safari for iPhone?

+2  A: 

Perhaps try onchange ?

webdestroya
Somebody's on the ball today... you beat me by 1 second! ps, event names don't use camelCase. This would cause an issue if declaring the event in JavaScript. Better to declare it as `onchange`.
Andy E
Hah I saw it right after I submitted. I thought it was a tie
webdestroya
Sorry this is kind of unrelated, but it's better to just have completely lowercase event names? I see most websites recommending thisCase for events.
thenickperson
Thanks for the suggestion webdestroya and dark_charlie, but onchange doesn't work. Would it be a bad idea to use both at the same time? I want this to work on as many browsers as possible, iOS or not.
thenickperson
@thenickperson - I am not sure why it is not working... perhaps try `onclick` for each `option` element? I would not have both at the same time (unless you have some sort of flag to make sure they dont run at the same time)
webdestroya
I already had onclick on all of my option elements. And nevermind about having them at the same time.
thenickperson
+1  A: 

Try onchange:

<select name="foo" onchange="bar();">
<!-- etc. -->
dark_charlie
(see above comment)
thenickperson