jquery - What does this statement means in javascript? -


i not able understand statement. tired on google showing example

$('#mydiv a:first').attr({     href : 'newdestination.html',     rel : 'super-special' }); 

its sets attribute dom element using attr method of jquery.

in example, setting href , rel attribute element matching selector '#mydiv a:first'.

'#mydiv a:first'

it means if there div id mydiv, take first child element anchor (a) , apply these attributes it.


Comments