determine which Element received an Event



determine which Element received an Event..

Answer / Mr.amit Kumar

To determine which element received an event in JavaScript, you can attach an event listener to that element. Here's an example using the 'click' event:nn```javascriptnconst myElement = document.getElementById('my-element');nnmyElement.addEventListener('click', function(event) {n console.log('The clicked element is:', event.target);n});n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JavaScript Code Interview Questions

write a code that user can choose/alter Body Text Size

1 Answers  


how to pass data between pages using Frames

1 Answers  


write a code to generate pseudorandom numbes

1 Answers   ABC,


create a slide show

1 Answers   Genpact,


how to copy form data between different pages

1 Answers  


validation code / function to allow only NUmbers in a text box

3 Answers   GE,


i am making a purchase sheet in html ,it contain names of product(by selecting checkboxes),quantity(textbox) and price(checbox), by using java script i am restricting the user to prevent them to enter the wrong data ,so i made the servlet were i am only able to prevent them to enter the page in empty field , so my doubt is how do you prevent them how to enter non numerical data in quantity field

2 Answers   Infosys,


Code for Adding Message and Confirmation Boxes Using JavaScript?

1 Answers  


code to get the coordinates of a Click Event

1 Answers  


communication between main window and new windows

1 Answers  


how to get the User's Time of Day

1 Answers   HCL,


how to delay a function call ?

1 Answers  


Categories
  • PHP Code Interview Questions PHP Code (33)
  • JSP Code Interview Questions JSP Code (6)
  • ASP Code Interview Questions ASP Code (5)
  • CGI Perl Code Interview Questions CGI Perl Code (3)
  • JavaScript Code Interview Questions JavaScript Code (63)
  • VB Script Code Interview Questions VB Script Code (20)
  • Shell Script Code Interview Questions Shell Script Code (31)
  • Python Code Interview Questions Python Code (34)
  • WinRunner Code Interview Questions WinRunner Code (1)
  • HTML DHTML XHTML Code Interview Questions HTML DHTML XHTML Code (13)
  • XML Interview Questions XML (43)
  • Scripts_Markup Code AllOther Interview Questions Scripts_Markup Code AllOther (5)