Jquery click on link

hi!

i’m having troubles assigning event handlers to DOM elements created by CHtml class methods

here is one example




<?php Yii::app()->clientScript->registerScript("exemplo",'

	$("#123").click(

		function () { 

      alert(1);

    });

')?>


<?php

echo CHtml::link("outro link","",array("id"=>"123"));

?>



i can’t manage to make the popup appear with this solution! Not even with <script></script> tags!!!

:-[


<?php Yii::app()->clientScript->registerScriptFile("http://code.jquery.com/jquery-1.4.2.js", CClientScript::POS_HEAD)?>


<script src="http://code.jquery.com/jquery-1.4.2.js" type="text/javascript"></script>

<?php Yii::app()->clientScript->registerScript("exemplo",'

	$("#123").click(

		function () { 

      alert(1);

    });

')?>




<?php

// echo CHtml::ajaxLink(

//        'Update Post', // The text for the anchor tag

//        'index.php?r=SpatialObject/ex' ,// The url for the ajax request

// 		array(

// 			'type'=>'POST',

// 			'data'=>array('hey'=>1)

// 		)

//);

echo "<br/>";


echo CHtml::link("outro link","",array("id"=>"123"));

?>

it works this way…sorry for the dumb question