egmund
November 30, 2019, 11:54am
1
I have a script on some pages, works in plain html, but give error in Revo:
script
$(document).ready(function(){
$(“#show2 ”).click(function(){
$(“#bekræftet ”).show();
$(“#bekræft ”).hide();
});
});
/script
Error is: TypeError: $ is not a function
What gives?
1 Like
nuan88
November 30, 2019, 1:35pm
2
I think you need the opening code of something like this <?
Here’s a sample of a simple php code in a snippet in Modx
<?php
return 'Hello, World!';
?>
egmund
November 30, 2019, 4:23pm
3
it is js script, not php
I have < script > - - - < /script > (without the empty spaces)
but it would not show in the post (therefore spaces this time).
1 Like
nuan88
November 30, 2019, 4:53pm
4
Ah yes, to post code you can put three single ticks ticks
above and below the code
Do you have the script in your section or in your footer? That’s where they should go…
egmund
November 30, 2019, 5:19pm
5
I have the script at top of ‘content’ in a ‘resource’ (page).
Actually I fixed it by adding this script:
< script src=“https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js ”>< /script>
apparently jquery.min could not be found in assets.
& where is the tick symbol on my keyboard anyway?
1 Like
nuan88
November 30, 2019, 6:40pm
6
Ah ok yeah, you have to link to the jquery file, either on another site or a local link to assets
For me the single tick is all the way at top left on my keyboard, right next to the number 1
egmund
November 30, 2019, 7:43pm
7
There was an obscure ‘inherited’ internal link, but that apparently did not point in the right direction. (inherited from a drupal 8 site).
My keyboard is Danish so I don’t know - anyway we figured it out.
1 Like
nuan88
November 30, 2019, 8:52pm
8
Yup, good job troubleshooting. I wish they would put the three ticks rule on the front page, but…