Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to listen to 'onclick' event on the document

Status
Not open for further replies.

Ahmad khalafalla

Programmer
Jun 20, 2021
1
EG
this way not working
document.addEventListener("onclick", () => {
console.log("EGYPT"
})
 
Hi

JavaScript:
document[teal].[/teal][COLOR=orange]addEventListener[/color][teal]([/teal][i][green]"[highlight]click[/highlight]"[/green][/i][teal], () => {[/teal]
    console[teal].[/teal][COLOR=orange]log[/color][teal]([/teal][i][green]"EGYPT"[/green][/i][highlight pink][teal])[/teal][/highlight]
[teal]})[/teal]
[ul]
[li]The event type is [highlight][tt]click[/tt][/highlight]. ( [tt]onclick[/tt] is a HTML attribute. )[/li]
[li]There is a missing [highlight pink][tt])[/tt][/highlight].[/li]
[/ul]


Feherke.
feherke.github.io
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top