Reputation: 251
Parent Class inddetails-wrapper clearfix
has two divs which as further classes having same name.
I want to select first class col-md-6 nopadding
. How should I do that ?
Below is the code:
<div class="inddetails-wrapper clearfix">
<div>
<div class="col-md-6 nopadding">...</div>
</div>
<div>
<div class="col-md-6 nopadding">...</div>
</div>
</div>
Upvotes: 2
Views: 52
Reputation: 2115
as this question was tagged under jquery You can select the first element inside <div class="inddetails-wrapper clearfix">
using Jquery like this:
var firstChild = $( ".inddetails-wrapper.clearfix div" ).first();
and you can play with firstChild
using more jquery properties depending upon what do you need.
Upvotes: 0
Reputation: 167172
You can use :first-child
:
.inddetails-wrapper div:first-child .col-md-6 {
background: #f00;
}
<div class="inddetails-wrapper clearfix">
<div>
<div class="col-md-6 nopadding">...</div>
</div>
<div>
<div class="col-md-6 nopadding">...</div>
</div>
</div>
Upvotes: 2