What's new

HTML Select Tag

rfresh

iPF Noob
I'm writing a web app that runs on the iphone/iPad. I have a listbox with an onChange() javascript event. I notice listboxes on Safari on the iphone/ipad do not fire on the onChange() event. What event should I be using if not onChange? or is there a trick to detecting the onChange() event?

Thanks
 
Sure it does!

<html>
<body>
<select onChange="alert('test');">
<option>Select an option</option>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</body>
</html>

That worked fine for me on iPad's Safari. Sure you're using the correct tags and there's not a javascript error in there somewhere?
 
I think the difference is that my SELECT is a multiple selection listbox. When I select items in the list and then touch the Done button in the list, the list goes away but the JS function does not fire.

PHP:
<SELECT NAME="frm_employees_cbo[]" MULTIPLE='multiple' onChange="employee_list_click();">
 
Ah yes, I see it with the multiple tag. The cheap "solution" would be to replace the onChange event with onBlur which still works. The better solution would be to investigate the onTouch... events and determine how to detect when a list item is changed, the Done button is tapped or something else is tapped which closes the list.
 
Options Aren't Showing Up until I click the select element

I have a multi select form element:

Code:
<select  id="something" name ="something" onchange="something();" multiple="multiple" >
<option value="something">something</option>
<option value="somethingelse">something else</option>
</select>

On the ipad, the options aren't showing until I click the select element. Before I do that it says "0 Items".

Any idea why? How to fix this? (BTW it works normally on a computer browser (IE, FF, Safari, Chrome, just not on the ipad)

Thanks.
 
I don't there is a way to do that. Until you manually select (or programatically select via Javascript) items, it shows 0, which in the iPad case, means no selections. 0 doesn't mean there are no items in the list, it means no items have been selected.
 
Okay, that's fine, if that's the default behavior. I haven't been able to find a guide to any of this stuff, so I'm just trying to figure things out as I go. Thanks.
 
asp.net Listbox does not render in ipad

The Asp.net list control renders like a dropdown control safari ipad. What is the solution for it?
 
I think the difference is that my SELECT is a multiple selection listbox. When I select items in the list and then touch the Done button in the list, the list goes away but the JS function does not fire...

PHP:
<SELECT NAME="frm_employees_cbo[]" MULTIPLE='multiple' onChange="employee_list_click();">

it not good, pls different solutions thanks
 
If you insist on using select tag, search google for
jquery tochecklist plugin.

Otherwise you can implement it via ul with images and CSS/js for a more native look and feel.
 
Last edited:

Most reactions

Latest posts

Back
Top