in my application I need to check if a drop down list has changed or not. can you please let me know how I should write it?
if (document.form.dropdownlist.???)
I don't know what to write instead of ????
You could give this dropdownlist an unique id:
<select name="foo" id="foo">
...
</select>
and then subscribe for the onchange
event (make sure you make the subscription once the DOM is loaded, for example in the body onload method):
var ddl = document.getElementById('foo');
ddl.onchange = function() {
alert('the value has changed');
};
var count=3;
function check()
{
var obj =new Array();
obj=document.getElementById("list");
checkLength(obj.length);
}
function checkLength(len)
{
if(len>count)
{
alert("Drop down size changed");
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.