jQuery: ID/name of element?

I’m new to jQuery - so question seems to be pretty simple - how to find id/name of the element? Code:


<script type="text/javascript">
$(document).ready(function() {
	$("input[@class=vote]").click(function() {
		$(this).attr("disabled","disabled");
		var a = ID/NAME of $(this) HERE
		alert(a);
	});
});
</script>

<input type="button" class="vote" id="12pictures" name="plus" value="hit me">
<input type="button" class="vote" id="45comments" name="plus" value="or me">

Thanks!

P.S. Spent 2 hours learning documentation - found nothing about id/name extraction (too sleepy probably).

Pardon me - forgot I already did same thing in another script few weeks ago using attr() function - looks like this:

<script type=“text/javascript”>
$(document).ready(function() {
$(“input[@class=vote]”).click(function() {
$(this).attr(“disabled”,“disabled”);
var a = $(this).attr(‘id’);
alert(a);
});
});
</script>

Now question is - how to pass content to element which ID I’ve just calculated?


<script type="text/javascript">
$(document).ready(function() {
	$("input[@class=votepictures]").click(function() {
		$(this).attr("disabled","disabled");
		var a = $(this).attr('id');
		var results = 'picturesresults' + a; // THIS IS TARGET ID

		$(#results).text('new results'); // This hellish thing doesn't work =(

		alert(results);
	});
});
</script>

<input type="button" class="votepictures" id="12" name="plus" value="vote +">

<span class="picturesresults" id="picturesresults12" >picture 12 results</span>

<input type="button" class="votepictures" id="23" name="minus" value="vote -">

<span class="picturesresults" id="picturesresults23" >picture 23 results</span>

P.S. Of course I know I can replace $(#results).text(‘new results’); with usual document.getElementById(results).innerHTML = ‘new results’; - but it’s not too good…

I suspect that you’re wanting to add the octothorpe to the beginning of the results string.


$('#' + results).text('new results');

Works. Brilliant. Many thanks!