Skip to content

How to select first div and change data of its.

Most of the time we need to select first div that time we are just thinking what need to do. But if you think it is very simple just follow below example.

Any query reply this post or comments.

 <script src=”” type=”text/javascript”></script>

 <script type=”text/javascript”>
 //runs once page is loaded and ready to be manipulated
        $(‘.genre’).first().delegate(‘.album-cover’,’click’,function() {
        var str = $(this).text();       
        str = parseInt(str) + 1;

    <div class=”genre”>
        <div class=”album-cover”>1</div>
    <div class=”genre”>
        <div class=”album-cover”>2</div>
    <div class=”genre”>
        <div class=”album-cover”>3</div>