+ 4

How to use (this) in javascript?

as the title describes i never able to find out how to use this "this" in javascript or ajax or jquery its pritty confusing and i am worries because it makes my programming base week. so i want to know what it is and how to use it?

12th Jan 2017, 4:58 AM
ARNAB BISWAS
ARNAB BISWAS - avatar
2 ответов
+ 6
HTML : <p>Hello</p> You want to change the above text to red onclick, so you use the selector first. jQuery : $(function() { $("p").on("click", function() { $(this).css("color", "red") }) }) The point is to recall the previous selector.
12th Jan 2017, 5:24 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 1
okk
13th Jan 2017, 5:31 PM
ARNAB BISWAS
ARNAB BISWAS - avatar