onChange / onSelectionChange

onChange / onSelectionChange











</> Source
<!DOCTYPE html>
<html>
<head>
	<title>onChange / onSelectionChange</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<style>
		#log_here {
			font-size: 8pt;
			font-family: Tahoma;
			width: 500px;
			height: 120px;
			border: 1px solid #cecece;
			padding: 2px 5px;
			overflow: auto;
		}
	</style>
	<script>
		var myCombo;
		var eventIndex = 1;
		function doOnLoad() {
			myCombo = new dhtmlXCombo("combo_zone", null, null, "image");
			myCombo.setImagePath("../common/flags/");
			myCombo.load("../common/data_countries.json");
			myCombo.allowFreeText(true);
			myCombo.attachEvent("onChange", function(value, text){
				log("onChange event, value: "+value+", text: "+text);
			});
			myCombo.attachEvent("onSelectionChange", function(){
				log("onSelectionChange event");
			});
		}
		function log(text) {
			var t = document.getElementById("log_here");
			t.innerHTML += (eventIndex++)+") "+text+"<br>";
			t.scrollTop = t.scrollHeight;
		}
	</script>
</head>
<body onload="doOnLoad();">
	<h3>onChange / onSelectionChange</h3>
	<div id="combo_zone" style="width:230px;"></div>
	<br><br><br><br><br><br><br><br><br><br>
	<div id="log_here"></div>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.