onchange

onchange event on input type=range is not triggering in firefox while dragging

孤街醉人 提交于 2019-11-25 18:45:53
When i played with <input type="range"> , Firefox triggers an onchange event only if we drop the slider to a new position where Chrome and others triggers onchange events while the slider is dragged. How can i make it happen on dragging in firefox? HTML <span id="valBox"></span> <input type="range" min="5" max="10" step="1" onchange="showVal(this.value)"> SCRIPT function showVal(newVal){ document.getElementById("valBox").innerHTML=newVal; } Apparently Chrome and Safari are wrong: onchange should only be triggered when the user releases the mouse. To get continuous updates, you should use the

android on Text Change Listener

孤街醉人 提交于 2019-11-25 16:57:41
I have a situation, where there are two fields. field1 and field2 . All I want to do is empty field2 when field1 is changed and vice versa. So at the end only one field has content on it. field1 = (EditText)findViewById(R.id.field1); field2 = (EditText)findViewById(R.id.field2); field1.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) {} public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { field2.setText(""); } }); field2.addTextChangedListener(new