PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, May 17, 2022

[FIXED] What is the string value for type command for an addeventlistener command?

 May 17, 2022     ajax, dom-events, event-handling, javascript, php     No comments   

Issue

Basically for element.addEventListener(), what is the type name of a keyboard type event?

For example:

somelement.addEventListener( <typename>, somefunction, false );

What is the value for <typename> for a keyboard type event? I'm basically building an AJAX based search box that will display results/suggestions as the user types in the search box.


Solution

It's usually the event name (as defined as inline html) without the word on.

Here's a reference to them all: http://javascript.gakaa.com/c/events.aspx

Edit: Not all HTML elements can use the same events. For example, a div can't have a "load" listener. EX: element.addEventListener("mousedown", doSomething, true);

Key events include: "keydown" "keyup" "keypress"

You can get the keycode via e.getKeyCode(); The window object should be the object listening for keyEvents.



Answered By - Jeffrey Sweeney
Answer Checked By - Cary Denson (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing