Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions Getting the ID of the element that fired an event using JQuery
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


samar
Getting the ID of the element that fired an event using JQuery
1 Answer(s)      4 years and a month ago
Posted in : JavaScript Questions


Hello sir

I want to know-Is there any way to get the ID of the element that fires the event? Please mention the code with your reply. This will make easy for me to understand the concept.

Thanks in advance


Advertisement
View Answers

December 11, 2010 at 4:38 PM


Dear friend

In jQuery event.target always refers to the element that triggered the event, where 'event' is the parameter passes to the function.

Use the following snippet in your code :

$(document).ready(function() {
    $("a").click(function(event) {
        alert(event.target.id);
    });
});


Related Tutorials/Questions & Answers:
Getting the ID of the element that fired an event using JQuery
Getting the ID of the element that fired an event using JQuery  Hello sir I want to know-Is there any way to get the ID of the element that fires... event.target always refers to the element that triggered the event, where 'event
JQuery-event working new element
JQuery-event working new element  I want to know- why not an event(in JQuery) works on my created element through jQuery
Advertisements
Using the jQuery event object
Using the jQuery event object       Using the jQuery event object JQuery... to these standards, this system normalize the event object. jQuery. Event
Bind custom event with an element using 'bind'
Bind custom event with an element using 'bind' In this tutorial, we will discuss about how to bind a user define event with an element using 'bind ' function of jQuery. In this example ,  we are firing an user
Test hidden element using JQuery
Test hidden element using JQuery  Suppose i have an element which i am hiding and showing, using .hide(), .show() or .toggle().How do you test to see... using following code snippet : $(element).is(":visible") Hope this will helpful
Getting the last inserted id using jsp
Getting the last inserted id using jsp  Pls how can i retrieve the last inserted id after submitting a form to mysql using jsp
Position one element relative to other using JQuery.
Position one element relative to other using JQuery.  Hello Sir...: none;" id="menu"> <!-- menu stuff in here --> </div> <div id... showMenu = function(ev) { //get the position of the placeholder element var
JQuery-Disabling element in JQuery.
JQuery-Disabling element in JQuery.   How can we enable/disable an element in JQuery
JQuery-Selecting class or ID
am getting little trouble in selecting an item using class or ID in jQuery?   Given below code selects an element of id name "element1" : $('#element1') Since IDs are unique, so it will select only the element of particular id
JQuery-Selecting class or ID
JQuery-Selecting class or ID  Hi Guys, I am new to JQuery. I am getting little trouble in selecting an item using class or ID in jQuery
Creating, getting, and setting content using jQuery
Creating, getting, and setting content using jQuery... content using jQuery Using jQuery , you can add(create) html content... by using jQuery and also can modify it .For example, you can get
JQuery-confirming exsistance of an element.
JQuery-confirming exsistance of an element.  Hi there, How do I test whether an element exists in jQuery?   You can check existance of an element in jQuery using length property of the jQuery collection
jQuery change event
jQuery change event In this tutorial , we will discuss about 'change' event of jQuery. In given below example ,the change event is fired when there is change in the element (on which event is set).When the second option
jQuery bind event
jQuery bind event In this tutorial, we will discuss about how to bind multiple events with an element using jQuery. In this example, a paragraph binds with multiple events like click, mouseenter mouseleave,  dblclick etc using
jquery href onclick event
jquery href onclick event  jquery href onclick event   $('a').click(function (event) { event.preventDefault(); //here you can also do all sort of things });   <script type="text/javascript
JQuery date change event
JQuery date change event  JQuery date change event I have been designing a date form in HTML and JQuery, wher i need two different date vales start date and end date for any event. I have already writen a function that allows
jQuery blur event
jQuery blur event In this tutorial , we will discuss how to handle blur event of jQuery. In the below example , there are two input field ,when you click... on any other elements in the page ,it shows an alert box .The blur event is sent
The scroll browser event of jQuery
The scroll browser event of jQuery In this tutorial ,we will print message on browser's window scrolling using scroll browser event of jQuery. In this example, some paragraphs are written , when we scroll down, a message
Understanding the jQuery event handling mechanism
Understanding the jQuery event handling mechanism       Understanding the jQuery event handling mechanism First of all , you need to know -What is an event
jQuery focus event
jQuery focus event In this tutorial, we will discuss about how to handle focus event of jQuery. In this example, 2 text field and one password field...()' method of jQuery.   focusEvent.html <!DOCTYPE html>
jQuery 'submit' form event
jQuery 'submit' form event In this tutorial, we will discuss about the  'submit' form event of jQuery. In this example... when "submit" event return 'true' to 'form'
'key down' mouse event of the jQuery
'key down' mouse event of the jQuery In this tutorial ,we will display ASCII value using "key down" method of jQuery. In this example...;/head> <body> <input id="whichkey" value="
jQuery '.live' & '.die' Mouse events
jQuery '.live'  & '.die' Mouse events In this tutorial ,we will discuss about how to  remove an event using 'die' mouse event of jQuery. In this Example, we removes the 'click' event
delete row using id
delete row using id  package pkg2; import org.hibernate.Query; import... = "delete from Insurance insurance where id = 2"; Query query = sess.createQuery...()); } } } this is the code m using . Error is -query must begin with SELECT or FROM
set the focus on an element using Javascript
set the focus on an element using Javascript  How to set the focus on an element using Javascript
Selecting element using jQuery.
Selecting element using jQuery In this tutorial , we will discuss about the different methods to select elements of html page. The jQuery has two ways...;jQuery selector example</h1> <h3> <ol id="orderedlist"
Auto select cell on mouse hover using 'hover' mouse event
Auto select cell on mouse hover using 'hover' mouse event In this tutorial, we will discuss about how to highlight Table's cell on mouse hover using jQuery 'hover' mouse event. In this example, a table is given
Printing Session Id Using Variable
Printing Session Id Using Variable  Hi, I am a learner in PHP language. Could any one guide me, how to print session Id using variable in PHP. Thanks
dynamically created links id from mysql table is not getting
dynamically created links id from mysql table is not getting  guys... to another page, but while i'm trying to access its value, i'm getting only... only getting the last recordset from table malayalamcinema, plz help me, its
Display message on scroll Event
Display message on scroll Event In this tutorial, we will discuss about how to display message on scrolling of text area using jQuery scroll event...;/head> <body> <div id="target" style="overflow: scroll
jQuery - jQuery Tutorials and examples
, getting, and setting content using jQuery Manipulating attributes... created many examples of using jQuery. View the demo's here. Learn jQuery step by step using the following tutorials: Overview of jQuery
Advertisements
 

 

 

DMCA.com