how can i capture the element that did an event and save it a $_SESSION['name']? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can i capture the element that did an event and save it a $_SESSION['name']?

5th Dec 2016, 10:41 AM
Diego Serra
Diego Serra - avatar
4 Answers
+ 1
when you call the function on JavaScript, you can add a paramether, and send (this), wich is, a reference to the object.
5th Dec 2016, 10:50 AM
Nahuel
Nahuel - avatar
+ 1
You can also use the "event.target" : function wichObj(event) { //other stuff your code do alert(event.target.tagName); //other stuff your code do }
5th Dec 2016, 11:00 AM
Nahuel
Nahuel - avatar
0
can u explain me that with code pls?
5th Dec 2016, 10:53 AM
Diego Serra
Diego Serra - avatar
0
But i want to get the event and save it on a SESSION VARIABLE like this function getFunction(event){ <?php $_SESSION['var'] = event.srcElement.innerHTML ; ?> }
5th Dec 2016, 11:04 AM
Diego Serra
Diego Serra - avatar