My Anytime date picker widget is not working. Here's my reference at Site Master:
<link href="Content/anytime/anytime.5.1.2.min.css" rel="stylesheet" type="text/css" />
<script src="Scripts/anytime/anytime.5.1.2.min.js"></script>
<script src="Scripts/anytime/jquery-1.11.0.min.js"></script>
<%--<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//www.ama3.com/anytime/anytime.5.1.2.js"></script>--%>
css is working fine, but the jquery and anytime.js doesn't. As you can see I have two lines commented, those two lines work pretty well if the source is directly to their web page, but if I reference it in my local it just doesn't work, no calendar nor time picker pops up.
Anyone who knows what i'm doing wrong?
Order of loading of scripts is important when there are dependencies such as a plugin that is dependent on jQuery.js.
The dependency must load first so switch the order of your loading:
<script src="Scripts/anytime/jquery-1.11.0.min.js"></script>
<script src="Scripts/anytime/anytime.5.1.2.min.js"></script>
You should be seeing errors thrown in browser dev tools console like $ is undefined due to improper order
I just made it to work.
I tried referencing it to the page where it was called upon and I noticed a difference in the "src".
<script type="text/javascript" src="../../Scripts/anytime/jquery-1.11.0.min.js" ></script>
<script type="text/javascript" src="../../Scripts/anytime/anytime.5.1.2.min.js" ></script>
whereas if I reference it in the Site.Master, those dots doesn't exist when you click the "Pick URL". I tried pasting it back to the Site.Master with the dots and it works.
Related
I am trying to use a datepicker using native JSF( without any exotic faces) however since I discovered that it doesnt have native support, I have tried to implement it using jquery. However I have tried literally every solution for doing this on the internet, and the datepicker calendar just doesnt show up when i click on the textbox. In the console of the dev tools, it seems to be giving an error of "the method datepicker is not defined". why so? I have literally tried including&excluding every single library. Below is my most recent attempt.
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script type="text/javascript" src="scripts/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript">
$(function(){
$("#dateOfExpense").datepicker();
});
<h:inputText size="20" id="dateOfExpense"/>
I downloaded the code from codepen.io and it does not work locally.
http://codepen.io/nanarth/pen/raarXe
I suspect that references to some libraries are not exported, but can figure out which.
Can anyone help me with this (I am new to this)
Thank you
UPDATE: Added the following code. Still not working
<head>
<meta charset="utf-8">
<title>Floor Plan - local coordinate map layers for D3.js</title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js"></script>
<script type="text/javascript" src="http://codepen.io/nanarth/pen/yyyqdL"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
Update #2: The screenshot of the error I am getting.
You're right, this pen is including external JS libs. Here's quick gif How to get there.
Those errors You got mean that jQuery libraries are not defined by the time that code runs. Ensure that:
You have copied JS code from the right pane in codepen
You have copied inline JS code from the left (html) pane in codepen
You wrap javascript in jQuery ready function
So what happens, is when then files are exported, one of the files is for some reason empty.
replacing
<script src='js/yyyqdl.js'></script>
with
<script src='http://codepen.io/nanarth/pen/yyyqdL.js'></script>
solved the issue.
Or the file can be downloaded and used locally and keep the old reference
I'm trying to import jQuery into blank javascript app, but keep getting same error: JavaScript runtime error: 'jQuery' is undefined. I don know the reason for this.
My whole procedure:
Create new Blank app project
Add existing item jquery-1.8.2-win8-1.0 in js folder
Drag and drop added item into default.html head
Add some jquery code in default.js
and now, i'm getting this error: JavaScript runtime error: '$' is undefined.
But if I delete added jQuery code(didn't notice before) it throw's me another error:JavaScript critical error at line 4, column 1 in ms-appx://8cce31f0-7793-41f7-875e-c41dd9ade2c7/js/jquery-1.8.2-win8-1.0.js.
I'm trying to get jquery to work for last several hours, but without success.
HTML code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>jquery</title>
<!-- WinJS references -->
<link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
<script src="//Microsoft.WinJS.1.0/js/base.js"></script>
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
<!-- jquery references -->
<link href="/css/default.css" rel="stylesheet" />
<script src="/js/default.js"></script>
<script src="js/jquery-1.8.2-win8-1.0.js"></script>
</head>
<body>
<p>Content goes here</p>
</body>
</html>
jQuery code:
$("*").on("click", function () { });
Error's:
Video:
Error - jQuery
First of all, thank you for the video - this would have been nearly impossible to solve without it.
I noticed your jQuery file was 2.0mb; this didn't look right. And then the error message took us into its contents to point out a syntax error, where we saw a slew of HTML tags — you appear to have downloaded from the GitHub viewer page, rather than from the source file itself. You should instead download the RAW file.
Please note also that this is an older version of jQuery, and not a fully-supported version. I am the primary developer behind the appendTo repo, and am excited to announce that jQuery 2.0 (pre-release builds available) should work really well on its own in a Windows Store App.
I wrote about this recently over on nettuts: Building Windows Store Applications With jQuery 2.0
Try to put:
<script src="js/jquery-1.8.2-win8-1.0.js"></script>
after:
<link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
This error is probably because you're not include jQuery library before writting jQuery code and make sure the path to your file is correct
Try rearranging the scripts you added. Include jQuery js file before your default.js file. Something like this:
<script src="js/jquery-1.8.2-win8-1.0.js"></script>
<script src="/js/default.js"></script>
Default.js tries to use jQuery which is not yet added. So rearranging might help.
I'm having some difficulty with what seems to be the simplest of operations.
In visual studio, when I change vsDoc from 1.4.1 to 1.5, javascript on the page no longer works. (Visual Studio 2010)
The original (that works) is like this:
<head runat="server">
<title></title>
<link type="text/css" href="css/excite-bike/jquery-ui-1.8.11.custom.css" rel="stylesheet" />
<script src="Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.11.custom.min.js" type="text/javascript"></script>
And everything is fine, intellisense is fine, javascript is fine. Everything is good to go.
However, when I reference the newer vsDoc file (obtained from ajax.aspnetcdn.com )
<head runat="server">
<title></title>
<link type="text/css" href="css/excite-bike/jquery-ui-1.8.11.custom.css" rel="stylesheet" />
<script src="Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.5-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.11.custom.min.js" type="text/javascript"></script>
The page doesn't load properly and firebug shows the following errors:
class2type is not defined
rootjQuery is not defined
Both errors are apparently stemming from the vsdoc file line 67
I feel like I'm missing something terribly obvious and I hope someone can fill me in.
Thanks!
The -vsdoc is not intended to be included in your actual page, just in the files you need intellisense in. For your use, just rename:
Scripts/jquery-1.5-vsdoc.js
to
Scripts/jquery-1.5.1-vsdoc.js
and then remove that -vsdoc.js <script> block from the page. Visual studio will automatically search for the -vsdoc.js of any local JavaScript file you're including default. It need not be included in the page explicitly...that'll actually lead to issues like you're seeing, since it defines the same empty functions (and not all the needed variables).
using this code:
<script src="<?php bloginfo('template_url'); ?>/scripts/hovermenus.js" type="text/javascript"></script>
to load this script
firebug is not showing this script as loaded, however, these scripts:
<script src="<?php bloginfo('template_url'); ?>/scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/scripts/salf_ui.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/scripts/date.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/scripts/datePicker.js" type="text/javascript"></script>
all load perfectly well. I have double, triple and quadruple checked the file is in the right directory.
Looks like the problem is with your file
Make sure the file .../scripts/hovermenus.js exists. Navigate there and copy paste the file name from there.
Could the script be in another directory? could it be hoverMenus.js or hover.menus.js.... etc.
If none of this works, try copying and renaming the file. See if you can load the renamed version. If you can't, it's something in the file.
Unrelated: You should declare your variables with var so you don't create a bunch of global variables attached to window.
You see these:
Why doesn't ASP.NET (3.5) always load an external javascript?
Firebug doesn't load JavaScript files or stop execution on breakpoints
charset isnt a valid attribute for the script tag, try removing it
EDIT
Actually it is valid, try removing it anyway :)
Make sure you've closed all your script tags above the one you're trying to load.
I had the similar problem: same file would not load on other pages(master pages)
original:
<script type="text/javascript" src="../../Scripts/scriptMob.js"></script>
fixed:
<script type="text/javascript" src="/Scripts/scriptMob.js"></script>
only removed dots and first slash
Additionally you can check in firebug(HTML section), expand the reference line
(+) <script src="../../Scripts/scriptMob.js" type="text/javascript">
to check whether browser actually reads the js file correctly.
the error message was saying:
[SqlException]: Error converting data type nvarchar to int.
Had a similar problem, shoving my head against a wall trying to figure it out. Turned out the js file had a syntax issue buried in it, something stupid that didn't show in my editor ... in this case it was a hanging 'var ' with nothing after it. As soon as I deleted that, everything was copacetic.
So my recommendation if you run into this is what I did - remove all functions and add them back one by one until you find one that kills it.
Had a similar problem, cant load script /js/search_ads.js It was problem in my adblock extension After renaming to search.js problem was disappearing