Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate 'a href="javascript:void(0)"' like link in cakephp?

Tags:

cakephp

How to generate 'a href="javascript:void(0)"' like link in CakePHP?

I make an application, the content will insert into the editor textarea when user click a list of image. I add a class to these images and write some code in the javascript file. Everything is going well.

But the link of the image is a URL address, but not 'href="javascript:void(0)' like URL. Anyone could tell me how to make it in CakePHP?

Thanks in advance!

like image 728
Ruiwant Avatar asked Jul 22 '26 04:07

Ruiwant


1 Answers

<?php 
   echo $this->Html->link(
        '/path/to/image/',
        'javascript:void(0)'
    );
?>

You can either set a path to the image or use the Html helper to generate the image tag code. The second parameter will set the href.

like image 107
Scott Harwell Avatar answered Jul 24 '26 00:07

Scott Harwell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!