1

With a textinput I can differentiate between readonly (receive click but no change of data) and disabled (no click).

I would need that with a checkbox or select. But there is only disabled.

I need to differentiate between clicked and changed.

Is that possible??

chris01
  • 10,921
  • 9
  • 54
  • 93
  • Does this answer your question? [Can HTML checkboxes be set to readonly?](https://stackoverflow.com/questions/155291/can-html-checkboxes-be-set-to-readonly) – Sachin Yadav Aug 03 '20 at 08:53

1 Answers1

2

You can addEventListener for click and change actually. So you can handle the callback base on the event that happen. this below is event handler for on change. am I answering your question?

const dropdown = document.querySelector("[name=dropdown]");

dropdown.addEventListener('change', (e) => {
console.log(e.target.value);
});
<select name="dropdown">
<option>Select DropDown</option>
<option value="1">test</option>
</select>