256 Kilobytes

Client-Side Comments

Type CommentsResponses to top-level threads. Category Client-SideDiscuss client-side web development, for example JavaScript.

Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

See also:

MoreSee also: https://www.256kilobytes.com/content/show/1916/javascript-vs-ecmascript-vs-typescript-vs-coffeescript-differences-what-to-use-and-when...
🗨 4
🐏 0
👁 740
Profile Photo - Default
Profile Photo - Default

JavaScript code is run on a browser...

MoreJavaScript code is run on a browser only, while Java creates applications that run in a virtual machine or browser. Java is a...
🗨 4
🐏 0
👁 740
Profile Photo - August R. Garcia

Reply to Client-side input validation question -- is it possible to make a CKEditor editor's input required?

Comments in Client-Side | By August R. Garcia

Published | Last Update

Profile Photo - August R. Garcia

To make CKEditor required on the client...

MoreTo make CKEditor required on the client side, adding a "required" attribute to the initial textarea will not work. Instead, some JavaScript is require...
🗨 1
🐏 0
👁 386
Profile Photo - Hash Brown

Reply to A family Journey is full of fun and cheer in Nepal

Comments in Client-Side | By Hash Brown

Published

Profile Photo - Hash Brown

I went on this tour and got raped

MoreI went on this tour and got raped
🗨 2
🐏 0
👁 5
Profile Photo - August R. Garcia

Reply to A family Journey is full of fun and cheer in Nepal

Comments in Client-Side | By August R. Garcia

Published

Profile Photo - August R. Garcia

I'm making a journey full of fun and che...

MoreI'm making a journey full of fun and cheer to Lowe's Home Improvement to buy Best Cheap Kerosine to burn this post down.
🗨 2
🐏 0
👁 5
Profile Photo - August R. Garcia

Reply to [Solved] CKEditor Autosave Draft Functionality - 1.4KB, No Plugin

Comments in Client-Side | By August R. Garcia

Published | Last Update

Profile Photo - August R. Garcia

PS: If you're wondering, this code is no...

MorePS: If you're wondering, this code is not yet live on 256 Kilobytes; will be in the next patch. Edit: There's a bug in the original code relat...
🗨 1
🐏 1
👁 5
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

d

Mored
🗨 1
🐏 0
👁 4
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Can add a few more regex lines to trim e...

MoreCan add a few more regex lines to trim empty commas: el.value = el.value.replace(/\n/g, ', '); el.value = el.value.replace(/\t/g, '...
🗨 1
🐏 0
👁 4
Profile Photo - Default
Profile Photo - Default

You should show some code. But this erro...

MoreYou should show some code. But this error generally is thrown when you use space between attributes. document.querySelector("[data-id='1'] [data-...
🗨 1
🐏 0
👁 466
Profile Photo - Default

Reply to What is the difference between Java and Javascript?

Comments in Client-Side | By Ali

Published

Profile Photo - Default

There is much difference between them.<b...

MoreThere is much difference between them. Java completely Object Oriented language. JavaScript prototype-based programming language. Even if Jav...
🗨 4
🐏 0
👁 740
Profile Photo - Default
Profile Photo - Default

Another approach is a prototype based so...

MoreAnother approach is a prototype based solution. Node.prototype.getElementsByTagNames = function (tags) { var elements = []; for (...
🗨 2
🐏 0
👁 405
Profile Photo - Default

Reply to JavaScript - How to hide a dialogue on click?

Comments in Client-Side | By Ali

Published

Profile Photo - Default

Did you mean "<dialog>" tag?

MoreDid you mean "<dialog>" tag? If so, you can use JS API like that; HTML5 Content <dialog open> <p>Greetings, one and al...
🗨 2
🐏 0
👁 1
Profile Photo - Univa
Profile Photo - Univa

Here's a simple solution that will catch...

MoreHere's a simple solution that will catch all characters, backspace, and delete.  $("input").keydown(function(event) {     var isW...
🗨 1
🐏 0
👁 1
Profile Photo - August R. Garcia

Reply to JavaScript - How to hide a dialogue on click?

Comments in Client-Side | By August R. Garcia

Published

Profile Photo - August R. Garcia

This should work:

MoreThis should work: <script> window.onload = function() { dialogues = document.getElementsByTagName("dialogue"); for (var iii = 0; iii...
🗨 2
🐏 0
👁 1
Profile Photo - WTCMolybdenam4753
Profile Photo - WTCMolybdenam4753

There is a simple solution to finding th...

MoreThere is a simple solution to finding the last update of a page in JS! Simply enter "javascript:alert(document.lastModified)" -without the quotes, int...
🗨 1
🐏 0
👁 398
Profile Photo - Graln_of_Truth
Profile Photo - Graln_of_Truth

You can try disabling Javacript and then...

MoreYou can try disabling Javacript and then reloading the page; this seems to be the most common issue however there are several other things you can try...
🗨 1
🐏 0
👁 373
Profile Photo - roxblade
Profile Photo - roxblade

The getElementsByTagName cannot be used...

MoreThe getElementsByTagName cannot be used to select multiple tags. You need to run multiple queries for the tags separately. Alternatively, you can also...
🗨 2
🐏 0
👁 405
Profile Photo - roxblade

Reply to What is the difference between Java and Javascript?

Comments in Client-Side | By roxblade

Published

Profile Photo - roxblade

Huge difference, really. Just because th...

MoreHuge difference, really. Just because they both have Java in their name doesn't mean they belong to the same family or even class of programming. Java...
🗨 4
🐏 0
👁 740
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

The function document.getElementByC...

MoreThe function document.getElementByClass() does not exist. The correct function is document.getElementsByClassName(). Documentation: h...
🗨 1
🐏 0
👁 668
Profile Photo - August R. Garcia

Reply to [JavaScript] Why does this code not work correctly? Code: function multiply(a, b){ a * b }

Comments in Client-Side | By August R. Garcia

Published | Last Update

Profile Photo - August R. Garcia

The function should state "return a...

MoreThe function should state "return a * b;" instead of "a * b;" // Define the function function multiply(a, b){ return a * b;...
🗨 1
🐏 0
👁 1,798
Profile Photo - August R. Garcia

Reply to jquery is not defined error

Comments in Client-Side | By August R. Garcia

Published

Profile Photo - August R. Garcia

Also, note that the dolalr sign in jQuer...

MoreAlso, note that the dolalr sign in jQuery is short for "jQuery" and that these two lines of code are equivalent: $(document).ready(fun...
🗨 2
🐏 0
👁 405
Profile Photo - Hash Brown

Reply to jquery is not defined error

Comments in Client-Side | By Hash Brown

Published

Profile Photo - Hash Brown

Hey

MoreHey That particular error can be 3 things: Your javascript file is not loading properly You have a botched version of jquery where someone...
🗨 2
🐏 0
👁 405
Profile Photo - Hash Brown
Profile Photo - Hash Brown

Super simple!

MoreSuper simple! In pure Javascript: <script type="text/javascript"> function theKeyPress(e){ var keynum; if(window.event) {...
🗨 1
🐏 0
👁 377
Profile Photo - August R. Garcia

Reply to CKEditor replace by class

Comments in Client-Side | By August R. Garcia

Published

Profile Photo - August R. Garcia

Yes, it can be done. Something along the...

MoreYes, it can be done. Something along these lines works. Can remove the try/catch statement at your discretion. try { // Intialize CKEditor Ins...
🗨 1
🐏 0
👁 394
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Am fairly sure there is no built-in way...

MoreAm fairly sure there is no built-in way to do this with pure CSS, but definitely doable with JS/jQuery.
🗨 1
🐏 0
👁 1
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

MoreHave seen a number of people recommend HTML Purifier:http://htmlpurifier.org/You might also look into PHP's strip_tags() function:http://php.net/...
🗨 1
🐏 0
👁 395
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Morevar c_menus = document.getElementsByClassName("c_menu");for (var iii = 0; iii < c_menu.length; ++iii) { c_menu[iii].addEventListe...
🗨 1
🐏 0
👁 419
Profile Photo - August R. Garcia

Reply to [CKEditor] Input validation?

Comments in Client-Side | By August R. Garcia

Published

Profile Photo - August R. Garcia

MoreInput validation through CKEditor is limited to the client-side, which means that the actual validation would occur on the server-side through PHP/Lar...
🗨 1
🐏 0
👁 388
Profile Photo - August R. Garcia

Reply to [JavaScript] addEventListener to all in array?

Comments in Client-Side | By August R. Garcia

Published | Last Update

Profile Photo - August R. Garcia

MoreUse this instead of a static variable. for (iii = 0; iii < arr.length; ++iii) arr[iii].addEventListener("click", function(e) { this....
🗨 1
🐏 0
👁 1
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

MoreThe function that you're looking for is .toFixed(2):https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFix...
🗨 1
🐏 0
👁 356