How to get the subject name from within a div class?
English
$(".subject ").click(function() {
// the script will declare here.
alert('You are select ' + $(this).find('p').text() + ' subject ');
});
div {
border:1px solid #999;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="subject ">
<img src="image/eng.jpg" />
<p>English</p>
</div>
<div class="subject ">
<img src="image/bio.jpg" />
<p>Biology</p>
</div>
<div class="subject ">
<img src="image/math.jpg" />
<p>Mathematic</p>
</div>
<div class="subject ">
<img src="image/sci.jpg" />
<p>Science</p>
</div>