Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

jquery find versus context selection

jquery find versus context selection  using -'jquery,jquery-selectors'

Having the following html snippet

<div class="something">
    <p>Some text</p>
<div class="somethingElse">
    <p>some other text</p>

I think the following jquery snippets are identical (will have the same result):

$(".something").find("p").css("border", "1px solid red");

$("p", ".something").css("border", "1px solid red");

My question is, whether one snippet is better than the other and should be used

asked Oct 13, 2015 by shegokar.anjeet
0 votes

Related Hot Questions

Government Jobs Opening