Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by vel on Nov 15, 2007 01:17
open dhtmlx forum
Add event

Hi,

I try to attach onclick and onchange events to dhtml combo.

but it is not working. my code is below

<div id="comboBox1" style="width:200px; height:30px;"></div>

<script language="javascript">

var z=new dhtmlXCombo("comboBox1","combo1",200);
z.enableFilteringMode(true,"/ajax/ajaxAction.do?mode=ajax",true,true);

z.onclick = function() {
alert("onclick");
}

z.onchange = function() {
alert("onchange");
}

</script>


Please advice



Answer posted on Nov 15, 2007 01:30
Mentioned methods was never a part of official API but just temporary fix.
From new version the events can be attached in way, default for other component


combo.attachEvent("onKeyPressed",function(event){
    //code here
})

combo.attachEvent("onBlur",function(event){
    //code here
})

combo.attachEvent("onChange",function(event){
    //code here
})