How to set previous value when cancelling a drop-down list change event

Viewed 11914

I am designing a html page. I want to show a confirmation msg on changing a drop down element using jquery or javascript. Please help to do this.

I have code which will ask confirmation. On selecting cancel it will not select previous item of Drop down.

$("#dropdownId").change(function(e) 
{
        if($(this).val() == "40")
        {
            if(confirm("Are you sure"))
                return true;
            else
                return false;
        }
});

Thanks

4 Answers
Related