CodeIgniter Forums
How to use anchor() to reference an anchor specified by an ID - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: How to use anchor() to reference an anchor specified by an ID (/showthread.php?tid=77661)



How to use anchor() to reference an anchor specified by an ID - HardyW - 10-01-2020

Suppose I have on a page somewhere the statement
Code:
<p id="AnchorOnPage">

How do I use the function anchor(...) or any other one to reference the paragraph (including parameters for the controller)?

is this in general possible using CodeIgniter?


RE: How to use anchor() to reference an anchor specified by an ID - nc03061981 - 10-01-2020

Use anchor with uri = '#AnchorOnPage'

Or use a with href="#AnchorOnPage"


RE: How to use anchor() to reference an anchor specified by an ID - InsiteFX - 10-01-2020

Like this:

Code:
<!-- Goes to here when clicked. -->
<a name="AnchorOnPage"></a>

<!-- Click will goto the above -->
<a href="#AnchorOnPage">Click Me</a>



RE: How to use anchor() to reference an anchor specified by an ID - HardyW - 10-01-2020

(10-01-2020, 05:44 AM)nc03061981 Wrote: Use anchor with uri = '#AnchorOnPage'

Or use a with href="#AnchorOnPage"

I would need something like

Code:
uri="aPage/#anchorOnPage/parameter1/parameter2"
Is this guaranteed to work?


RE: How to use anchor() to reference an anchor specified by an ID - InsiteFX - 10-01-2020

No that will not work, it will not take parameters.

What you want would have to be done using JavaScript or jQuery.