CKEditor 3.1 jquery adapter? - asp.net-mvc

<script type="text/javascript" language="javascript" src="/Content/Scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/Content/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/Content/ckeditor/adapders/jquery.js"></script>
<script type="text/javascript" language="javascript">
$(function() {
$('textarea.ckeditor').ckeditor();
});
</script>
<textarea class="ckeditor" cols="5" id="Title" name="Title" rows="5">
</textarea>
It all works fine but before loading page it alerts this "Microsoft JScript runtime error: Object doesn't support this property or method"
But it works after the Visual Studio alert, what might be the reason ?
Thanks in advance

You should put the code to create the CKEditor instance after the textarea element (or on the onload event of the page).
I don't think that this is also part of the problem, but the folder as distributed is named "adapters", not "adapders"
And it works later because the textarea has the class="ckeditor", so that textarea is automatically replaced: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#.replaceClass

Related

jQuery-UI datepicker TypeError: o is undefined

I am not able to find out, why this error appears:
TypeError: o is undefined jquery-ui.min.js:9:4005
This is my javascript:
$(document).ready(function() {
$('.inputDate').datepicker({
dateFormat:'dd.mm.yy',
});
});
This is my HTML:
<label class='required'
for='event_start'>Datum</label>
<input id='event_start'
class='inputDate'
name='event_start' readonly
value='22.04.2019'>
The included files in the head of the page:
<link rel="stylesheet" type="text/css" href="js/jquery-ui-1.12.1/jquery-ui.min.css" media="screen"> </link>
<script language="JavaScript" type="text/javascript" src="js/jquery-1.12.1.min.js"></script>
<script language="JavaScript" type="text/javascript" src="js/jquery-ui-1.12.1/jquery-ui.min.js"> </script>
The datepicker widget appears, but nothing happens, after I choose a date. I see the above error message in firefox web developer tools.
I found the reason of the problem:
The HTML element id="event_start" occurred several times in the code.
Jquery uses the id to map the datepicker to the proper input element although a class is defined as selector.

http://localhost:52951/app/app/app.module.js 404 (Not Found) scripts in layout not working

Im trying to add angular 5 to my mvc project for almost two days now and its not working. When I load the page I get these errors
my scripts view is an .ascx file and the scripts look like this
<!-- Polyfill(s) for older browsers -->
<base href="/">
<script src="<%: Url.ContentWithTimestamp("~/node_modules/core-js/client/shim.min.js") %>"></script>
<script src="<%: Url.ContentWithTimestamp("~/node_modules/zone.js/dist/zone.js") %>"></script>
<script src="<%: Url.ContentWithTimestamp("~/node_modules/systemjs/dist/system.src.js") %>"></script>
<script src="<%: Url.ContentWithTimestamp("~/systemjs.config.js") %>"></script>
<script>
SystemJS.import('<%: Url.ContentWithTimestamp("~/app/main.js") %>').catch(function(err){ console.error(err); });
</script>
Edit: This is the project I put angular in.
Here is one of the packages (dont want to upload img of everyone.They are there.)
The problem was in my main.js. This line:
var app_module_1 = require("./app/app.module");
should be like this:
var app_module_1 = require("./app.module");

jQuery UI error: TypeError: this._addClass is not a function [duplicate]

I am having an issue getting a dialog to work as basic functionality. Here is my jQuery source imports:
<script type="text/javascript" src="scripts/jquery-1.9.1.js"></script>
<script type="text/javascript" src="scripts/jquery-ui-1.11.1.js"></script>
<script type="text/javascript" src="scripts/json.debug.js"></script>
Html:
<button id="opener">open the dialog</button>
<div id="dialog1" title="Dialog Title" hidden="hidden">I'm a dialog</div>
<script type="text/javascript">
$("#opener").click(function() {
$("#dialog1").dialog('open');
});
</script>
From the posts around seems like as a library import issue. I downloaded the JQuery UI Core, Widget, Mouse and Position dependencies.
Any Ideas?
Be sure to insert full version of jQuery UI. Also you should init the dialog first:
$(function () {
$( "#dialog1" ).dialog({
autoOpen: false
});
$("#opener").click(function() {
$("#dialog1").dialog('open');
});
});
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" />
<button id="opener">open the dialog</button>
<div id="dialog1" title="Dialog Title" hidden="hidden">I'm a dialog</div>
if some reason two versions of jQuery are loaded (which is not recommended), calling $.noConflict(true) from the second version will return the globally scoped jQuery variables to those of the first version.
Some times it could be issue with older version (or not stable version) of JQuery files
Solution use $.noConflict();
<script src="other_lib.js"></script>
<script src="jquery.js"></script>
<script>
$.noConflict();
jQuery( document ).ready(function( $ ) {
$("#opener").click(function() {
$("#dialog1").dialog('open');
});
});
// Code that uses other library's $ can follow here.
</script>
If you comment out the following code from the _Layout.cshtml page, the modal popup will start working:
</footer>
#*#Scripts.Render("~/bundles/jquery")*#
#RenderSection("scripts", required: false)
</body>
</html>
Change jQueryUI to version 1.11.4 and make sure jQuery is not added twice.
I just experienced this with the line:
$('<div id="editor" />').dialogelfinder({
I got the error "dialogelfinder is not a function" because another component was inserting a call to load an older version of JQuery (1.7.2) after the newer version was loaded.
As soon as I commented out the second load, the error went away.
Here are the complete list of scripts required to get rid of this problem.
(Make sure the file exists at the given file path)
<script src="#Url.Content("~/Scripts/jquery-1.8.2.js")" type="text/javascript">
</script>
<script src="#Url.Content("~/Scripts/jquery-ui-1.8.24.js")" type="text/javascript">
</script>
<script src="#Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript">
</script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript">
</script>
<script src="#Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript">
</script>
and also include the below css link in _Layout.cshtml for a stylish popup.
<link rel="stylesheet" type="text/css" href="../../Content/themes/base/jquery-ui.css" />
I had a similar problem and in my case, the issue was different (I am using Django templates).
The order of JS was incorrect (I know that's the first thing you check but I was almost sure that that was not the case, but it was). The js calling the dialog was called before jqueryUI library was called.
I am using Django, so was inheriting a template and using {{super.block}} to inherit code from the block as well to the template. I had to move {{super.block}} at the end of the block which solved the issue. The js calling the dialog was declared in the Media class in Django's admin.py. I spent more than an hour to figure it out. Hope this helps someone.

Jquery datepicker not working after postback

It works at first open of the page but when i navigate to other pages that uses also the datepicker. It no longer works. Did i missed something in my code? Please see below. Thank you so much.
<link href="css/custom-theme/jquery-ui-1.10.3.custom.css" rel="stylesheet" />
<script src="js/jquery-1.9.1.js" type="text/javascript" language="javascript"></script>
<script src="js/jquery-ui-1.10.3.custom.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" language="javascript">
$('#btnDfrom').focus(function () {
$(this).datepicker();
});
$('#btnDto').focus(function () {
$(this).datepicker();
});
</script>
<span id="filtertxt">Date From: </span>
<input type="text" id="btnDfrom" />
<span id="filtertxt">Date To: </span>
<input type="text" id="btnDto" />
This one does not work also
$(function(){
$('#btnDfrom').datepicker();
$('#btnDto').datepicker();
});
Jquery UI datepicker isn't intended to be called multiple times on the same element, which is what would happen if you call it on a focus event.
All you need to do is call it once on the target element, like so:
$(function(){
$('#btnDfrom').datepicker();
$('#btnDto').datepicker();
});
The datepicker plugin will take care of handling clicks and focus events on the elements by itself, you don't need to.
EDIT: You should also check that you are both including the script files, css files and this code on each page where you use the datepicker (but make sure it's only included once!)
your code is looking cool
$(function(){
$('#btnDfrom').datepicker();
$('#btnDto').datepicker();
});
check your code I think may be jquery is Conflicting somewhere in your pages.

TypeError: $("#datepicker").datepicker is not a function

Ive read the other questions about this and I know that this is related to date picker not loaded on the page. however I would like to know how to figure out which functions have loaded with JQuery.
The code I'm using is quite basic so I'm not certain why this is failing anyways:
<script type='text/JavaScript' src='jquery.js'></script>
<script type='text/JavaScript' src='jquery.ui.core.js'></script>
<script type='text/JavaScript' src='jquery.ui.widget.js'></script>
<script type='text/JavaScript' src='jquery.ui.datepicker.js'></script>
<script src='jquery.validate.js' type='text/javascript'></script>
<link href='jquery_ui_base\jquery.ui.all.css' rel='stylesheet' type='text/css'>
<script type='text/javascript'>
jQuery(function() {
calender();
});
function calender(){
$( '#datepicker' ).datepicker()
}
</script>
this usually happens when the jquery core and/or the datepicker js is not being loaded.
check if it's loading (a 200 response). Make sure you have the correct paths and proper read permissions.
also, make sure the jquery core is loaded before the datepicker, and that datepicker is loaded before $( '#datepicker' ).datepicker() .
Also, you could try uploading a new version of datepicker.

Resources