AndyJarrett Code. Develop. Manage.

Clearning all next Select elements with jQuery

I am doing a search criteria page which needs to clear the preceeding <select> options should any one of them change.

jQuery makes all Js work easy but my solution wasn't as elegant as it could be, it was more like something that was beaten down with rotten fish. At first I had switch statements then I was looping over this and that until I remembered about the .index() function and got the code down to 2 lines. Hopefully this saves someone else later on

The jQuery$("select").change( function(){ // Get the index so we know which other