Q:

How to get the attributes of a HTML element using JQuery?

I am wondering whether there is a way in which I can get the value within a given HTML element using JQuery?
Example
<span id="45463_test"></span>

(using the proper tags made the code to processed)
What I want is the '45463_test' value within the id attribute (using JQuery).
Thanx for the responses and the edit.
I would it such that I can get the attribute value of a tag which has been clicked.

A:

If you only want to get the ID of the <span/> you clicked then it's better to apply a click event handler to each span and catch the attribute value.
$("span").click(function() {
  return $(this).attr("id");
});

