Aloha editor - Uncaught ReferenceError: Aloha is not defined - javascript

So this looks like a completely simple thing that I must be missing, but here goes:
I've been following the guide for Aloha editor, here.
I have included aloha.js in my page (and it is included, it is pulling down all the CSS etc).
I then have this code in my page:
<script type="text/javascript">
Aloha.ready(function(){
Aloha.jQuery('textarea.description').aloha();
});
</script>
Which throws an uncauht referenceerror.
In the console, GENTICS.Aloha is defined, but Aloha is not.
What am I missing?

<script type="text/javascript">
Aloha.ready(function(){
Aloha.jQuery('.description').aloha();
});
</script>
You only specify the CSS classname as far as I know like shown above.

Related

Script stopped working without any recent code changes on the site

I have inherited a site and don't really understand the set-up!
The scripts on the site were all working ok then we are suddenly getting script errors and the script that entered a date in a field has stopped working.
this is at the top of the page:
<script type="text/javascript">
setURLs(//domainname/base/administration/);
</script>
I am getting this error: Unexpected end of input - what do I need to do to fix that?
Then this script:
<script>DateInput('Payment_Date', true, 'yyyy-mm-dd','2022-07-20')</script>
is giving the error DateInput is not defined and the field is not been added to the form - how do I sort that?
from the two lines of code that you shared I noticed a problem with
<script type="text/javascript">
setURLs(//domainname/base/administration/);
</script>
the // means comment so in order to make the function work you need to add some ' around it
like this
<script type="text/javascript">
setURLs('//domainname/base/administration/');
</script>

jQuery "$ is not a function" error

I swear I have included jquery in the page header, it is right there!
Nonetheless the following code, which I've included near the bottom of the page (and inline for now) gives me an error saying "TypeError: $ is not a function."
<script>
function displayResult(longA, latA, longB, latB, units) {
$("#distance").html(calcDist(longA, latA, longB, latB, units));
if (units=="m") {
$("#unitLabel").html("miles");
$("units").prop("selectedIndex",0);
} else {
$("#unitLabel").html("kilometers");
$("#units").prop("selectedIndex",1);
}
$("#longA").val(longA);
$("#latA").val(latA);
$("#longB").val(longB);
$("#latB").val(latB);
}
$("#calculateButton").click(function() { //This is the line it's complaining about
var longA=$("#longA").val();
var latA=$("#latA").val();
var longB=$("#longB").val();
var latB=$("#latB").val();
var units=$("#units").val();
displayResult(longA, latA, longB, latB, units);
})(jQuery);
</script>
Higher up in the page header I've got the following:
<script src="jquery.js" ></script>
<script src="calcDistSinglePage.js" ></script>
I'm not using Wordpress or anything, this is a very straightforward hand-coded HTML page.
Try wrapping your code in a closure (which is considered good practice anyways):
(function($) {
$("#calculateButton").click(function() {
// do stuff...
});
}(jQuery));
If this snippet still complains with the same error, there's bound to be a problem with the way you're loading the jQuery library.
Also, make sure that you don't overwrite the $ variable in your other code. For example, inside calcDistSinglePage.js.
The dollar-sign is a very straight-forward javascript variable and can be reassigned to whatever you want. According to the error, $ currently is something but not a function (otherwise you'd receive a ReferenceError stating that $ is undefined). So probably, somewhere in your code, you've overwritten it.
Make sure the jQuery library it's the first script you load.
Add this just before the closing </body> tag.
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-{{JQUERY_VERSION}}.min.js"><\/script>')</script>
Download the file locally and inside js/vendor/ add the file.
Replace the value {{JQUERY_VERSION}} in the script above adding your jquery version.
Here one CDN you could use.
https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js
https://code.jquery.com/jquery-2.1.3.min.js
You are probably linking it from a root folder that is not your HTML folder. Use an absolute path:
<script src="/jquery.js" ></script>
Or make sure jquery.js is in the same folder as your HTML.

ckeditor: "a is undefined"

I just added CKEditor to my website, but I'm getting the following error in my console:
I followed the installation guide as it's written so I have no idea what's wrong.
Here's, briefly, what my call looks like:
<textarea id="full-editor" name="full-editor" rows="10" columns="6"></textarea>
<script type="text/javascript">
CKEDITOR.replace('#full-editor');
</script>
Aah.. try this
Remove # from the selector inside CKEDITOR.replace('#full-editor');
According to installation guide you shared, this is what u need
CKEDITOR.replace('full-editor'); // NO #. You must have got confused with jQuery
This also happened whenever we put initializer script before <textarea>.
Ensure to put
<script>
CKEDITOR.replace( 'editor1' );
</script>
before the </body> tag (i.e. closing body tag).
<script type="text/javascript">
CKEDITOR.replace('#full-editor');
</script>
Please add above code in external js file and include this js in html page after title page like
$(document).ready(function () {// save as like ckEditorInclude.js
CKEDITOR.replace('#full-editor');
}
<script src="Your folder path/ckEditorInclude.js" type="text/javascript"></script>
This also happened whenever we put initializer script before .
Ensure to put
CKEDITOR.replace( 'editor1' );
before the </body> tag (i.e. closing body tag).
This append to me because i was trying to use CKEDITOR.replace("editor") but there was no element in dom with Id or name "editor"
The issue for me was I copied the code locally from the cdn so that I can work on it if I am not online. I am using version 4.9.2 standard.
Examining the chrome console gave several 404 errors which were not obvious using FireFox. Reverting back to the cdn resolved the issue.
Unfortunately, no working offline with this it seems at least not for this version of ckeditor.

jQuery $ is not a function

I have a problem including a jQuery script in my webpage. I always get the error "$ is not a function" in line 6. I reduced my script to the following very simple one:
$(document).ready(function(){
myTest();
});
function myTest(){
window.console && console.log($("#test"));
}
Why is there an error in line 6? Why not already in line 1?
You have not included jquery.js in your page, or the path you have used is incorrect. Here is an example one using Google's CDN:
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
// your code here...
</script>
</head>
</html>
The line numbers given in browser error messages are notoriously unreliable, always use the actual error message as a guide to the problem.
Hi Please download and include jquery.js or jquery.min.js
in script tag
Give jquery.js path in script src attribute
This error message means that jQuery is not included

Easy Pie Chart no effects

I recently used the plugin easy-pie-chart: rendro.github.io/easy-pie-chart/
On the page, I've included the js file
<script src="vendor/easy-pie-chart-master/src/easypiechart.js"></script>
I add this code
<div class="chart" data-percent="73" data-scale-color="red">73%</div>
and recalled the plugin
<script type="text/javascript">
$(function() {
$('.chart').easyPieChart({
//your configuration goes here
});
});
</script>
It does not appear, however, no result, belonging to the number written in the normal manner.
What is the reason?
The console gives me error like:
Uncaught TypeError: Object [object Object] has no method 'easyPieChart'
Some of you could help me: I thank you all in advance
I think easyPieChart.js path is not correct ,check the path or give
<script src="http://rendro.github.io/easy-pie-chart/javascripts/jquery.easy-pie-chart.js"></script>
Fiddle

Categories

Resources