Example 1.
//Bind the change event to the select drop-down box of name=model, //When the value of the drop-down box changes, //Get the latest value of the drop-down box and assign the new value to the element with id=resourceConfig. $('select[name="mode"]').on("change",function(event){ var plan_description = $(this).find("option:selected").data("desc"); $('#resourceConfig').val(plan_description); });
Example 2.
//Bind the click event to the li element with name=item_mode, // When the li element is clicked, add an active style to the li element. $("li[name='item_mode']").on("click", function(event) { $(this).addClass("active"); });