inherit
169267
0
Nov 23, 2024 18:59:51 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Oct 16, 2020 4:56:43 GMT -8
Does the html code go in header and footer only? Or can I put above the js code?
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on Oct 16, 2020 8:19:27 GMT -8
I assume you are creating a plugin?
If so, the html code goes in the header and footer area only. JS can go in the JS area, or you can put it in the header/footer areas but it must be in <script> tags.
|
|
inherit
169267
0
Nov 23, 2024 18:59:51 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Oct 16, 2020 8:53:27 GMT -8
Thank you
|
|
inherit
169267
0
Nov 23, 2024 18:59:51 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Oct 16, 2020 12:27:52 GMT -8
So I have another question on html, how do I direct my plugin to a custom page? I normally would use a div. Is it different now now that I've separated the html from js?
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,846
January 2015
msg
|
Post by Lynx on Oct 16, 2020 14:57:16 GMT -8
If you want your plugin to run on just a certain custom page, you can put this in your JS before it does anything else (after the $(document).ready)
if(pb.data('route') && pb.data('route').params && pb.data('route').params.page_id == "your-page-ID-here"){ your_function(); } else { return; }
change the your-page-ID-here to your page's actual ID. That will check to see if they're on your custom page. If not, the script will end without running anything else.
your_function() will be the first function that runs if they're on the page.
|
|
inherit
169267
0
Nov 23, 2024 18:59:51 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Oct 17, 2020 18:01:06 GMT -8
Thank you guys
|
|