javascript function doesn't call in internal page on click of link yii CListView

i am using CListView in my one of form. i used CHtml::link in one of column. and its html is like this

<a class="text-dark" value="31" href="javascript:void(0)" title="You received a new message">

and onclick of this link i called one javascript function

following function



        var id = $(this).attr('value');



                        url:'<?php echo Yii::app()->createUrl('/mailbox/message/View') ?>/id/'+id,




                                        alert('Your data has not been submitted..Please try again');




My main issue is on first page it works perfect. function is called perfectly. but whenever i click on next button from pagination and click on this link. function is not called. Except One page any page doesn’t call function. What is problem?

switching pages use background ajax request and then replacing CListView container DIV with new content. Problem is that your jquery function is called only once on main page load and does not apply to newly loaded content.

Try to provide javascript handler for afterajaxUpdate ( or use

$(‘a.text-dark’).live(‘click’, function()…

or .on() function in jQuery >=1.7 (as manual suggest)

jQuery(document).on( eventName, selector, function(){} );

Thanx a lot. it helps me. works perfect. :rolleyes: