Tag Archives: javascript

Get element on event with jquery

by in , on

What If we apply an event on multiple element? Yes in this post we are talking about to get the element on particular event. Let’s say we have more then one element and on these elements we want the click event. But now how do we detect the clicked element. In the given example, i just talking two input fields, with different name and id. And apply the click event on both elements.

Here is the HTML Example:

Countdown timer in javascript

by in on

Here i introduce with the simple countdown timer script written in JavaScript. My main purpose behind this countdown timer script is just logout the user if he/she is idle. In this example i set the idle time 15 minutes, means the user will automatically logout if he/she do not active on the page. To achieve this i used window.setInterval() javascript function, which is call my own defined function after every 1 second. As you see in the below example i have created a function getIdleTime(), this function calculate every minute and second and display to the user, as you see i called an id with document.getElementById(), just call the id where you want to show your countdown timer.

Keyboard key codes detect with JQuery

by in , on

JavaScript is one of the best Server Scripting Language for client side programming and JQuery is one of its library. JQuery is widely used by designers because it’s providing a lot of functionality just with few easy steps well I am not talking here about the designing part; we are talking about the keyboard key detection.

JavaScript Methods to Detect Keyboard keys:

There are three methods to detect the key codes of keyboard.

  1. keyup
  2. keydown
  3. keypress

If we are talking about the cross-browser compatible then keyup and keydown are the best solution for this.