I want to get the reference of the corresponding hello when the checkbox is clicked. Please help me to guide what to do
I have tried this that when the checkbox is change then the pass function will be called. But dont know how to get the reference of hello so that i can apply styling if the checkbox is changed.
3
Answers
Try:
If you are using plain html and javascript you can achieve this by giving the the element an id, like this.
<p id="your-element-id">Hello</p>
And, in the function that you are passing to the
input: check
field, you can access that element by it’s id.Like this :
You will need to pass wither
event
orthis
to the inlineonchange="pass()"
handler.Here is an example of a global event listener: