I am trying to use sails.js and Zurb Foundation 6.2. I used this handy npm generator that sets up my grunt tasks. The output looks pretty good. I have a single js file that contains jquery, foundation, etc.
In my layout.ejs, I have this:
<!DOCTYPE html>
<html>
<head>
<title><%=typeof title == 'undefined' ? 'New Sails App' : title%></title>
<!-- Viewport mobile tag for sensible mobile support -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--STYLES-->
<link rel="stylesheet" href="/styles/app.css">
<!--STYLES END-->
</head>
<body>
... some html ...
<%- body %>
<!--SCRIPTS-->
<script src="/js/dependencies/sails.io.js"></script>
<script src="/js/dependencies/foundation.js"></script>
<!--SCRIPTS END-->
<script>
$(document).foundation();
</script>
</body>
</html>
When I run the page, I get this error:
**TypeError: url.indexOf is not a function
jQuery.fn.load()
foundation.js:9612
<anonymous>
foundation.js:11913
<anonymous>**
My reading on this suggests that the issue is either that something is not be loaded, is being loaded more than once, or is in the wrong order. How do I narrow that down? I tried to use CDN's for each piece and still couldn't make it work.
Thank you for your help.
I was using jquery.poptrox.min.jsfor image popping and zooming and I received an error which said: “Uncaught TypeError: a.indexOf is not a function”error. This is because indexOfwas not supported in 3.3.1/jquery.min.jsso a simple fix to this is to change it to an old version 2.1.0/jquery.min.js.
This is because indexOfwas not supported in 3.3.1/jquery.min.jsso a simple fix to this is to change it to an old version 2.1.0/jquery.min.js. This fixed it for me. Share Follow edited Feb 12 '20 at 19:12
const str = 1234; // ⛔️ Uncaught TypeError: str.indexOf is not a function const result = str.indexOf('3'); We called the indexOf method on a number which caused the error. The indexOf method is only supported on strings and arrays.
Foundation is not currently compatible with jQuery 3.0.0, Foundation is using the deprecated jQuery.fn.load()
. Use jQuery 2.2.x for now. See issue and PR:
https://github.com/zurb/foundation-sites/issues/8834
https://github.com/zurb/foundation-sites/pull/8923
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With