+ 3

When do we use "this" at a function??

26th Feb 2018, 9:05 PM
Sina
Sina - avatar
4 Answers
+ 5
I think it would be helpfull for your question <button id="1" onClick="reply_click(this.id)">B1</button> <button id="2" onClick="reply_click(this.id)">B2</button> <button id="3" onClick="reply_click(this.id)">B3</button> <script> function reply_click(clicked_id) { alert(clicked_id); } </script>
26th Feb 2018, 9:12 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 3
Thank you my friend
26th Feb 2018, 9:19 PM
Sina
Sina - avatar
+ 2
no need for thank always be there for help^_^
26th Feb 2018, 9:20 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
Oh don not tell that it wasn't your duty
26th Feb 2018, 9:26 PM
Sina
Sina - avatar