Change the value of an text box onlick

Change the value of an text box onlick

Hi,

I cant figure out how to realise a script, which captures the "rel" attribut of a span you click on and put the content of this attribut into a text box.

This is my script so far:

$('.seite').click(function() {
var test = $(this).attr('rel');
$('#startlimit').val(test);
});

I need this script for a pager function... .