Kurosawa Hiroyuki
Kurosawa Hiroyuki

Reputation: 1267

binding <select> change event using jQueryMobile/PhoneGap

I want to run following html/JS code in PhoneGap, but the alert dialog is not shown up and the following line is in the LogCat window; the following warning appeared and alert did not showed.

[ERROR]

W/InputManagerService(266): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient

I jus want to fetch selected value on the change of the value, what's the problem? please help

[CODE]

<html>
<head>
    <script type="text/javascript" charset="utf-8">
        $("#selectcount").change(function() {
            alert('hello');
        }).change();
    </script>
</head>
<body>
<div id="dialog" data-role="page">  
    <label for="select-choice-0" class="select">Number:</label>
    <select id="selectcount" name="select-choice-0" id="select-choice-0">
        <option value="50">50</option>
        <option value="100" selected="selected">100</option>
        <option value="500">500</option>
        <option value="1000">1000</option>
    </select>
</div>
</body>
</html>

Upvotes: 0

Views: 5851

Answers (1)

shaunsantacruz
shaunsantacruz

Reputation: 8930

Where are you loading jquery mobile?

Also, your code needs to be wrapped in the document ready function:

$(document).ready(function(){
    $("#selectcount").change(function() {
        alert('hello');
    });
});

Upvotes: 2

Related Questions