How can I get the content of CKEditor using JQuery?

use the CKEditor.editor.getData() call on the instance. That is to say: HTML <textarea id=”my-editor”> <input id=”send” type=”button” value=”Send”> JS for CKEditor 4.0.x $(‘#send’).click(function() { var value = CKEDITOR.instances[‘DOM-ID-HERE’].getData() // send your ajax request with value // profit! }); JS for CKEditor 3.6.x var editor = CKEDITOR.editor.replace(‘my-editor’); $(‘#send’).click(function() { var value = editor.getData(); // send your …

Read more

Scroll smoothly to specific element on page

Question was asked 5 years ago and I was dealing with smooth scroll and felt giving a simple solution is worth it to those who are looking for. All the answers are good but here you go a simple one. function smoothScroll(){ document.querySelector(‘.your_class or #id here’).scrollIntoView({ behavior: ‘smooth’ }); } just call the smoothScroll function …

Read more

HTML-encoding lost when attribute read from input field

EDIT: This answer was posted a long ago, and the htmlDecode function introduced a XSS vulnerability. It has been modified changing the temporary element from a div to a textarea reducing the XSS chance. But nowadays, I would encourage you to use the DOMParser API as suggested in other anwswer. I use these functions: function …

Read more

Isotope v2 filtering with Infinite Scroll – Filter not finding all items and Window not resizing on filter

For question 2, one thing you could do is applying the display:none style to all hidden elements (and remove from all the visible ones) after isotope filtering. I think you should be able to use the “on layoutComplete” event listener of isotope to apply it at the right time, like this: $container.isotope( ‘on’, ‘layoutComplete’, function( …

Read more

How to use jQuery in Firefox Extension

I use the following example.xul: <?xml version=”1.0″?> <overlay id=”example” xmlns=”http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul”> <head></head> <script type=”application/x-javascript” src=”https://stackoverflow.com/questions/491490/jquery.js”></script> <script type=”application/x-javascript” src=”example.js”></script> </overlay> And here is an example.js (function() { jQuery.noConflict(); $ = function(selector,context) { return new jQuery.fn.init(selector,context||example.doc); }; $.fn = $.prototype = jQuery.fn; example = new function(){}; example.log = function() { Firebug.Console.logFormatted(arguments,null,”log”); }; example.run = function(doc,aEvent) { // Check …

Read more

Google Place API – No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access [duplicate]

I got it working after finding answer by @sideshowbarker here: No ‘Access-Control-Allow-Origin’ header is present on the requested resource—when trying to get data from a REST API And then used this approach to get it working: const proxyurl = “https://cors-anywhere.herokuapp.com/”; const url = “https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=${latitude},${longitude}&radius=500&key=[API KEY]”; // site that doesn’t send Access-Control-* fetch(proxyurl + url) // …

Read more