Jquery- reload doesnt occur if clicked second time -


<li id="rpt21" align=left><a  class="keepopen" href="#">trade list buys</a></li> 

if click on above link 'trade list buys', list gets loaded in right side of screen. however, when click again while on same page, doesnt reload data on right side. looks static. how can ensure reloads every time click.

below rpt21 function gets executed.

$("#rpt21 a.keepopen").click(function() {     $("#report_panel").hide();     $("#report_header").hide();     $("#report_panel_alldata").hide();     $("#report_header_alldata").hide();     var rmanager = $("#rmanager").val();     var manager = $("#manager").val();     var account = $("#account").val();     var folderdate = $("#folderdate").val();     var pricedate = $("#pricedate").val();;     x = getdataforrpt(rmanager, manager, account, folderdate, pricedate, "buy_list", "d:\\web\\webtmp", "post_op_rpt_20150617_4700.html", "runrpt");     $("#report_panel").show(); }); 

it working first time not after that, can happen if recreating dom elements.

in scenario can use event delegation.

$(document).on('click', "#rpt21 a.keepopen", function(){     //your code }); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -