I am searching for a jQuery or CSS selector for a special issue -


i searching jquery or css selector special issue. have

<div class="parent">    <div class="grid1">       <p>grids have p</p>    </div>    <div class="grid2">       <p>grids have p</p>    </div>    <div class="grid3">       <p>grids have p</p>    </div>     <p>if p present, .grid1 should not have margin</p> </div>  <div class="parent">    <div class="grid1">       <p>grids have p</p>    </div>    <div class="grid2">       <p>grids have p</p>    </div>    <div class="grid3">       <p>grids have p</p>    </div> </div> 

this have tried:

if($('.parent').has('p')){    console.log(this); } 

but dont know how trigger parent, had p?!

$('.parent p').each(function(){ $(this).siblings(".grid1").css('margin', "0px");` }) 

this should p elements inside parent div, , make div grid1 class @ same level margin equal zero.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -