Using class selector to change val text to rel text

Using class selector to change val text to rel text

Hi,

I'm trying to change the value - val() of an input element to be the same as its rel attribute text - and I'm using a class selector.

I thought I might be able to do something like this:

jQuery(".myClass").val(jQuery(this).attr("rel"));

but I can't :((

So for each element that has the class myClass, the val() should = the rel

My code, as I have it set up at the moment, kind of means I have to use a class selector, as above.

Any help or suggestions much appreciated.