cola
cola

Reputation: 12466

jQuery help: I can't get the result selecting the anchor link of cakephp $this->Html->link

echo $this->Html->link($val['Post']['title'],
                                    array('controller'=>'posts','action'=>'view',$val['Post']['id']),
                                    array('id'=>'rightSideLink')).'<br/>';


$("#rightSideLink").mouseover(function(){
    $(this).addClass('classTableRow');
})

$("#rightSideLink").mouseout(function(){
    $(this).removeClass('classTableRow');
})

It's not working. What to do ?

Upvotes: 0

Views: 85

Answers (1)

teacher
teacher

Reputation: 1015

it is completely working... you can test this code which i m providing you below.... just change controller and model as per your requirement.....

<?php
echo $this->Html->link($user['User']['username'],
                                    array('controller'=>'users','action'=>'view',$user['User']['id']),
                                    array('id'=>'rightSideLink')).'<br/>';
?>
<style>
.classTableRow{
    background: lime;
    width: 200px;
    height: 200px;
    padding: 30px;
}

</style>
<script type="text/javascript">
$("#rightSideLink").mouseover(function(){
    $(this).addClass('classTableRow');
});

$("#rightSideLink").mouseout(function(){
    $(this).removeClass('classTableRow');
});
</script>

i checked it by myself... you just do one thing... just hover over #rightSideLink..... by the way what you found not working....

Upvotes: 2

Related Questions