jQuery Mobile Select frozen option

Hi,

I can fill a jQuery Mobile Select with the required items. I am using it with muti selection enabled. As i am using it with nativeMenu set to true, is there a way to have a fixed option on top of the list that never changes and cannot be selected, and describes something (such as “Select Animal”)?

Thanks

According to the docs, jQM Select multi-selection doesn’t work with navtiveMenu set to true.

Using the SelectMulti sample project as an example, adding the following code prevents the first item in the list from being selected (nativeMenu set to false):

Sub Main()
  $("#Select1_inner-listbox-popup .ui-first-child").css("pointer-events", "none")
End Sub

Kind regards,
Doug

Thanks Doug. Your code prevents the first item from being selected.

Actually, multi-selection does work with nativeMenu set to true. I’ve used it.
With my application, i have an icon with no text (just an arrow is shown). When it’s clicked, the items show but it would be nice if a top heading describing the options below is shown. Is this possible with nativeMenu also set to true?

Thanks

Copy that on multi-selection working with nativeMenu for you.

The html is different for nativeMenu, so how about something like this?

Sub Main()
  $("#Select1 select").prepend("<option disabled>Select Animal</option>")
End Sub  

This would replace my earlier code suggestion above and may solve both issues for you.

Kind regards,
Doug

Thanks Doug.

It’s nearly there. As the top option is disabled, it is very difficult to read the writing.
I’m also wondering whether the associated tick box could be hidden.

Cheers

I’m afraid I can’t get multi-selection to work with nativeMenu within AppStudio 6 here. I’m not sure how you got around the limitation but unless I can see what you’re seeing, I’m unable to help with that. Sorry.

Kind regards,
Doug

No problems Doug.
With Chrome on my PC, i’m unable to get it to work either. Clicking it doesn’t bring up the items.
When i run it on my phone, it works fine. I’ll have a play around and see if it can be changed.
Thanks for your help.