SHERIN AS SHERIN AS - 3 months ago 10
jQuery Question

how to show particular div using jquey



<div class="companyname" data-companyname="abc" ></div>
<div class="companyname" data-companyname="xyz" ></div>
<div class="companyname" data-companyname="pqr" ></div>





i need show only data-companyname="abc" div only....so i used following way in jquery



$(".companyname").attr('abc').show();




how it is get?

Answer

$('div[data-companyname="abc"]').show()
.companyname {
  display: none
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="companyname" data-companyname="abc">1</div>
<div class="companyname" data-companyname="xyz">2</div>
<div class="companyname" data-companyname="pqr">3</div>

use the attr selector