JQuery + Jeditable - detection when selection changes

I use Jeditable for in-place editing. One of the controls I'm working with has a type select. When the user clicks on this field, the following selectcontrol is created:

<div id="status" class="editable_select">
    <form>
        <select name="value">
            <option value="Active">Active</option>
            <option value="Inactive">Inactive</option>
        </select>
        <button type="submit">Save</button>
        <button type="cancel">Cancel</button>
    </form>
</div>

I am trying to figure out how to use jQuery to detect when this control is selectmodified, especially since it does not have an identifier attribute.

This is what I have so far, but the event does not fire:

$(document).ready(function () {
    $('#status select').change(function () {
        alert("Change Event Triggered On:" + $(this).attr("value"));
    });
});

UPDATE

Updating jQuery 1.4.2 solved my problem along with using Matt solution.

+5
source share
1 answer

, , , ( , ).

, , live

$(document).ready(function () {
    $('#status select').live('change', function () {
        alert("Change Event Triggered On:" + $(this).attr("value"));
    });
});

, 1.7, , on() . :

$(document).ready(function () {
    $(document).on('change', '#status select', function () {
        alert("Change Event Triggered On:" + $(this).attr("value"));
    });
});
+7

All Articles