javascript - Detect change of option values of an select field using jquery -
is there way of event binding recognize when options of select field changed different, external, not editable javascript?
just clearify: don't want listen value changes, want listen change of dom structure
have tried this?
this tell if there change structure.
$(".selectbox").bind("domsubtreemodified", function() { $(".message").append("structure changed<br>"); }); $("#add").click(function() { $(".selectbox").append("<option>added</option>"); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <button id="add">add select</button> <select class="selectbox"> </select> <div class="message"></div>
if looking data or attributes. looking mutationobserver
mutationobserver provides developers way react changes in dom. designed replacement mutation events defined in dom3 events specification.
Comments
Post a Comment