[Solved] How to select only one pragraph in html and to change color with jquery [closed]
you can select them in different ways Here you can select the elements by number… $(“div”).children(‘:nth-child(1)’).css(“background”, “red”); // $(“div”).children(‘:nth-child(1)’).html(); // for content or $(“div p:nth-child(1)”).css(“background”, “red”); than you could use the first-child selector $(“div”).children(‘:first-child’).css(“background”, “red”); or $(“div p:first-child”).css(“background”, “red”); JSFIDDLE more solutions by kaypaul (posted in comments) $(“div p”).eq(1).css(‘background-color’,’#ccc’); $(“div p”).eq(3).addClass(‘bg-blue’); kaypauls JSFIDDLE 5 solved … Read more