javascript - Jquery Activate on DropDownList/SELECT item changed -


i have jquery code filters out list of links on page. @ present filtering fired when link wih blind href clicked. id of link taken determine content remains visible on page. eg:

<script type="text/javascript"> $(document).ready(function () {      //when link in filters div clicked...     $('#filters a').click(function (e) {          //prevent default behaviour of link         e.preventdefault();          //get id of clicked link(which equal classes of our content         var filter = $(this).attr('id');          //show list items(this needed hidden ones shown)         $('#content ul li').show();          /*using :not attribute , filter class in selecting         list items don't have class , hide them '*/         $('#content ul li:not(.' + filter + ')').hide();      });  }); 

i need changed that, jquery activated when option changed in dropdownlist/select. however, cant quite head around how change jscript detect selection in ddl rather hyperlink.

any appreciated.

thanks.

use change() event

$("#idofdropdown").change(function() {     //code here     var filter = this.value //gets value of selected dropdown item. }); 

this fire each time dropdown selection has been made.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -