php - focus on dynamically generated div -
i generating div in controller dynamically .there can n number of div's.i doing ajax , in response generating div.and on keydown want focus on div.i manage keydown effect.i tried focus not working. here div generated dynamically in controller
echo '<div class="col-md-12 srch-result" style="cursor:pointer;text-indent:10px;padding:5px 0px 5px 3px" data-uid="'.$rows->user_id.'" data-uname="'.$rows->firstname." ".$rows->lastname.'">'.str_ireplace($keyword,'<b>'.$keyword.'</b>',$rows->firstname." ".$rows->lastname).'</div>'
and code in view append result inside div
$('#page_to').keyup(function(){ var keyword = $('#page_to').val(); $.ajax({ type:'post', url:'<?php echo base_url("user/userlist"); ?>', data:'keyword='+keyword, success:function(response) { $('#search-result').show(); $('#search-result').show('1000'); $('#search-result').html(response); } }); });
Comments
Post a Comment