xxxxxxxxxx
$("select [name='element_name']").change(function(){
// condition goes here
});
xxxxxxxxxx
$(function(){
$("#status").change(function(){
var status = this.value;
alert(status);
if(status=="1")
$("#icon_class, #background_class").hide();// hide multiple sections
});
});
xxxxxxxxxx
// Using jQuery, detect the change event on the select element
$('select').change(function() {
// Perform the desired action when an option is selected
// You can access the selected option using $(this).val()
var selectedOption = $(this).val();
// Code to execute when the option changes
// e.g., updating the page content, making an AJAX request, etc.
console.log("Selected option: " + selectedOption);
});
xxxxxxxxxx
// Wait until the DOM is fully loaded
$(document).ready(function() {
// Bind a change event listener to the select element
$(document).on('change', 'select', function() {
// Handle the change event here
var selectedValue = $(this).val();
console.log('Selected value:', selectedValue);
});
});
xxxxxxxxxx
$("#mySelectElementID").val("my_new_value"); //change selected option/value with jQuery