javascript - jquery click event occurs twice for single click -


i have used jquery click function, basic wrking when click on 1 button div come down , on next click come back, based on visiblity check. have pagination implemented webpage , webpage displays search results. button displayed next each search result. when click on set of buttons in first page, work fine, when go second page, nt wrk, instead open , close. add code here

$("#attachment").live("click", function() {     attachmentrow = $(this).attr('class');     //class value==att0 - 9 unique each button     attachmentrow = attachmentrow.replace('att', '');     if (typeof results.hits.hits[attachmentrow]._source.attachments != 'undefined') {         if ($(".attdrop" + attachmentrow).is(':visible')) {             $(".attdrop" + attachmentrow).empty();             $(".attdrop" + attachmentrow).hide();         } else {             $(".attdrop" + attachmentrow).show();             var attachmentrowlength1 = results.hits.hits[attachmentrow]._source.attachments.attachments.length;             (var j = 0; j < attachmentrowlength1; j++) {                 $(".attdrop" + attachmentrow).append("value");             }         }     } }); 

the template part follows

<script id="srchtemplate" type="text/x-jquery-tmpl">  <div style="width: 700px; float:left; margin-bottom:15px;"><a href='${_source.htmlrefname}' target='_new'> <div id="title">${_source.filingcik}</div><div id="title">${_source.formtype}</div></a>          <div class="att${getnextname()}" id="attachment">attachment present</div></div> <div style="width: 700px; float:left; margin-bottom:15px; padding-bottom:10px; border-bottom:1px solid #cccccc;"> <div id="formtype">${_source.parentformtypecategory}</div><div id="date">filing date: ${_source.datefiled}</div></div> <div class="attdrop${dropgetnextname()}" id="realattachment"></div> </script>  


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -