Is there any way that I can get the id of an element from something like:
Some text
Doh.. If I get you right, it should be as simple as:
$('.test').click(function() { console.log(this.id); });
Some text Some text Some text
You can just access the id property over the underlaying dom node, within the event handler.