select an unknown class in jquery -


we write code in js select class(whitn't class or id name):

var x=document.getelementsbytagname("p"); x[2].style.color="red" 

please note x! how in jquery?!

try .css() selecting .eq() choose this

$(document).ready(function(){     $("p:eq(2)").css("color","red");    //or     $("p").eq(2).css("color","red"); }); 

consider x[2] select 3rd 'p' tag eq(2) do.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -