Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling HTML SELECT Options with event delegation to javascript on iPhone Safari

We are developing a web application with GUI customized to use on iPhone. A page on the app has 3 subsequent SELECT dropdowns, where selection of an option from 1st dropdown derives the options for 2nd dropdown, and so forth. The subsequent dropdown options are populated by javascript based on onchange event on previous dropdown. The problem is that, on iPhone the options for a SELECT appears with 'prev' and 'next' links to move to previous and next control. When the 'next' link is clicked, then the control moves to next SELECT and displays the options. The javascript is triggered by onchange event for previous SELECT and populates the options for next SELECT. But on dropdown for 2nd SELECT displays the previous options before it is repopulated by the javascript. Is there a workaround or event that can sequence execution of javascript and then selection of next control? Is there any event that can be triggered when a SELECT option is selected and before control leaves the SELECT element? Is there a handle for Next and Previous links for SELECT dropdown option display?

like image 705
Dhaval Pawar Avatar asked Oct 06 '10 23:10

Dhaval Pawar


1 Answers

Maybe you could use the focus event, in jQuery this would be:

$('#select2').focus(function () {
    // update select2's elements
});

Although the real question is when the iPhone overload comes in, and when the event get fired. And also can the select options be changed whilst in this view.

like image 135
Marcus Whybrow Avatar answered Sep 24 '22 04:09

Marcus Whybrow