Home › Forums › JavaScript › jQuery variable › Re: jQuery variable
May 8, 2013 at 9:21 am
#134438
Participant
$ function returns collection of elements – a list. In your case it is one element list, but it’s still a list. You have to specify what element from the list you want to get. Use first() function and it shoud resolve your problem.
like this:
$(‘#kort .id1 a’).first().attr(‘href’,$(‘.kort-nav li.id1 a’).first().attr(‘href’));