jQuery .change event

0 votes
371 views
added Oct 31, 2018 in Javascript by LC Marshal Captain (25,790 points)
retagged Jul 16, 2019 by LC Marshal
// The event handler are bind to text input, select box, etc upon changing the data of element
$("#request-status-select, #request-organization-select")
.on("change", function() {
  search();
});

 

2 Responses

0 votes
responded Jul 15, 2019 by LC Marshal Captain (25,790 points)
$('#religion').on('change', function() {
	if ($(this).val() === 'others' ){
		$('.religion_others-wrap').collapse('show')
			.find('input').focus().val('');
	} else {
		if ($('.religion_others-wrap').hasClass('in')){
			$('.religion_others-wrap').collapse('hide');
		}
	}
});

 

0 votes
responded Jul 16, 2019 by LC Marshal Captain (25,790 points)
$('#trafficsrc').on('change', function(){
	var tsrc = $(this).val()
	if(tsrc == 'Others'){			 
		$('#trfsrc_others-wrap').show();
	} else {
		$('#trfsrc_others-wrap').hide();	
	}
});

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...