wordpress: moment.js is not defined - wordpress

On my website, I can see an error releating to moment.js, however, moment is loaded, not sure what the error could be?
<script defer type='text/javascript' src='https://www.n1bar.com/wp-includes/js/dist/vendor/moment.min.js' id='moment-js'></script>
<script defer type='text/javascript' id='moment-js-after'>
moment.updateLocale( 'en_GB', {"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"monthsShort":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"weekdays":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"weekdaysShort":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"week":{"dow":1},"longDateFormat":{"LT":"g:i a","LTS":null,"L":null,"LL":"F j, Y","LLL":"j F Y H:i","LLLL":null}} );
</script>

Related

$(...).datepicker is not a function- works on one server but not on another

I know this topic was opened here a lot, and I know that the problem for other users was that they included the Jquery.js file more than one time so there was a conflict between the files, however this isn't my case but I am still getting this error and couldn't find a solution that worked for me from previous Questions.
This is the code I am using on the .aspx file head section
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />
<link href = "css/jquery-ui.min.css"rel = "stylesheet"/>
<script type="text/javascript" src="Scripts/jquery-3.2.1.min.js"></script>
<script src = "js/jquery-ui.js" type="text/javascript"></script>
<script src="Scripts/UserPlans.js" type="text/javascript"></script>
I made sure that the jquery link comes before the jquery-ui
and in UserPlans.js file I have
$(document).ready(function () {
$("#calendar").click(function () {
$('#datepicker').datepicker({ defaultDate: new Date($("#formatedDate").val()) });
});
$('#datepicker').datepicker();
});
I get the following error :
Uncaught TypeError: $(...).datepicker is not a function
at HTMLDocument.<anonymous> (UserPlans.js?v=57153.032911662754:8)
at j (jquery-3.2.1.min.js:2)
at k (jquery-3.2.1.min.js:2)
However, I must point out that this code is in production in two different servers, in one of them it works without any problems, and in the other it gives this error I have just described. can it be related to the hosting machine somehow?

How to get innerHTML of iframe

<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/MemberProfile" data-id="https://www.linkedin.com/in/terimariedegree" data-format="inline" data-width="300" data-related="false"></script>
Please refine your answer, also you might want to lookup https://www.w3schools.com/jsref/prop_frame_contentwindow.asp

windows.kendo is undefiend on kendo.aspnetmvc.min.js

i get this error on kendo.aspnetmvc.min.js :
windows.kendo is undefiend .
my cod :
<script src="~/Scripts/jquery-1.7.1.min.js"></script>
<script src="~/Scripts/kendo/kendo.aspnetmvc.min.js"></script>
<script src="~/Scripts/kendo/kendo.web.min.js"></script>
<script src="~/Scripts/jquery-migrate-1.1.1.min.js"></script>
Try putting the include for kendo.web.min.js before the include for kendo.aspnetmvc.min.js. It needs to be there before the MVC stuff is included.

jquery noConflict issue

I am trying to use Lightbox plugin but with jquery there is a conflict and gone through some articles and find out to get work around this but I have no luck in implementing it.
Here is my code:
References:
<link href="Lightbox/css/lightbox.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Lightbox/js/prototype.js"></script>
<script type="text/javascript" src="Lightbox/js/scriptaculous.js?load=effects,builder"> </script>
<script type="text/javascript" src="Lightbox/js/lightbox.js"></script>
Script:
<script type="text/javascript">
jQuery.noConflict();
(function ($) {
$(document).ready(function () {
$("a[rel=lightbox[group1]]").live("click", function () {
$("a[rel^='lightbox[group1]']").lightbox();
return false;
});
});
})(jQuery);
</script>
Any help will be greatly appreciated!
I am using jquery 1.5.2 version
To prevent $ conflicts between jQuery and prototype, you have to put jQuery.noConflict(); right after you include jQuery and before any other code that expects $ to belong to another library. Then, once you've done that, $ will not map to jQuery, it will be used by the other libraries.
You don't show how you include jQuery. Here's an example right from the jQuery doc page for .noConflcit():
<script type="text/javascript" src="other_lib.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$.noConflict();
jQuery(document).ready(function($) {
// Code that uses jQuery's $ can follow here.
});
// Code that uses other library's $ can follow here.
</script>
In your case, I think your code would go like this:
<link href="Lightbox/css/lightbox.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Lightbox/js/prototype.js"></script>
<script type="text/javascript" src="Lightbox/js/scriptaculous.js?load=effects,builder"> </script>
<script type="text/javascript" src="Lightbox/js/lightbox.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
jQuery.noConflict();
(function ($) {
$(document).ready(function () {
$("a[rel=lightbox[group1]]").live("click", function () {
$("a[rel^='lightbox[group1]']").lightbox();
return false;
});
});
// other jQuery code that uses $ can go here
})(jQuery);
// other jQuery code that uses jQuery (but not $) can go here or in other script tags
</script>
The order of including js files in relation to the call to jQuery.noConflict() is critically important.
You could try using jQuery object instead of $:
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery("a[rel=lightbox[group1]]").live("click", function () {
jQuery("a[rel^='lightbox[group1]']").lightbox();
return false;
});
});
</script>
Everything looks right, so I'm thinking jQuery isn't loaded?
If using jQuery instead of $ doesn't work, then that's probably the case.
If you have the jQuery script in your site header, you'll want check FireBug's net console to see if it loaded - Google Chrome also has a nice network monitor you can use.
You could also use a jQuery lightbox instead of introducing the prototype library just to use a single plugin.

JQuery Session problem

I am using jQuery session in my master page. Anything I'm missing?
Code:
<script type="text/javascript" language="javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.session("lnkID","A1")
});
</script>
Error:
Microsoft JScript runtime error: Object doesn't support this property or method
By your example alone, you're missing a reference to the required files, and you're not wrapping your jQuery code in script tags. You need to reference not only jquery-source, but jquery-json, and jquery-session as well.
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/jquery.json.js"></script>
<script type="text/javascript" src="scripts/jquery.session.js"></script>
Once you've got those in place, you need to place your logic within script tags:
<script type="text/javascript">
$(function(){
$.session("foo", "bar");
});
</script>
See the following demo for an example: http://www.jaysalvat.com/session/test1.html
Lastly, the language attribute of the script tag is deprecated. You can do away with it, but keep the type attribute.

Resources