Daniel
Daniel

Reputation: 1402

jquery mobile - add button to select menu

I'd like to allow user make a manual entry, besides listed in select menu.

So I try in JS to add button "manual" to select control of JQM, and upon click let the user enter his data. But somehow I'm unable to hook onclick event of the button. By clicking on button for first time nothing happens, by second click select opens it's options. See it here http://jsfiddle.net/jQAMh/17

For demo reasons function to be called is pretty simple:

function userEntry() {
    alert("onclick hook works!");
}

Any ideas?

Thanks in advance!

Upvotes: 0

Views: 184

Answers (1)

Jonathan Naguin
Jonathan Naguin

Reputation: 14766

It seems that the select jQuery Mobile component is receiving the event instead of the input element. Try adding z-index: 9999; to the class of the button: .button-span:

.button-span {
    position: absolute;
    right: 0;
    margin-top: -7px !important;
    float: right;
    top:5px;
    z-index: 9999;
}

You can see a demo here.

Upvotes: 1

Related Questions