Tag: JavaScript

JavaScript is a scripting language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else.

  • JavaScript: how to check if a string variable is an integer value

    JavaScript: how to check if a string variable is an integer value

    Written by

    in

    In JavaScript, one way to check if a variable is of type integer, Number.isInteger() can be used: But this solution has the disadvantage, that a string with integer value like ’22’ will result in false. Use parseInt You can use the parseInt function to parse a string and convert it into an integer. If the…

    Read more

  • JavaScript: the differences between escape(), encodeURI(), and encodeURIComponent()

    JavaScript: the differences between escape(), encodeURI(), and encodeURIComponent()

    Written by

    in

    In JavaScript, escape(), encodeURI(), and encodeURIComponent() are three functions used to encode strings for different purposes. Each function serves a distinct purpose, and it’s essential to understand their differences: escape() The escape() function is used to encode a string so that it can be safely included in a URL query string. It encodes special characters,…

    Read more

  • jQuery methods in plain JavaScript

    jQuery methods in plain JavaScript

    Written by

    in ,

    Life is already very complex, so let’s simplify your projects by removing all the jQuery code. Plain JavaScript provides the same functionalities and it does not require any additional frameworks. And it’s supported by most of the modern browsers out of the box. This is a list of replacements for your daily used jQuery methods.…

    Read more

  • JavaScript: simple code structure for libraries

    JavaScript: simple code structure for libraries

    Written by

    in

    The code of a JavaScript library might get very complex over time. This can be a problem for maintenance and expandability. When writing a library, you should address two main points: The following “template” provides a simple code structure that fulfills those points: You can use such a library the following way: Inspiration: https://stackoverflow.com/questions/13606188/writing-a-library-what-structure Photo…

    Read more

  • Which programming language is the best one?

    Which programming language is the best one?

    Written by

    in

    Is it really possible to answer this question? Yes, the correct answer is: all of them. Or let’s ask another question first: for which problem? There is not “the one and only” best programming language, there are tons. This question is simply not a good one. It’s good for endless discussion, but it’s neither complete,…

    Read more

  • JavaScript: String in String suchen

    JavaScript: String in String suchen

    Written by

    in

    Eine Zeichenkette (String) lässt sich in einem anderen String wie folgt suchen: …oder über den Tilde-Operator*: Diese beiden Varianten berücksichtigen jedoch keine Groß- und Kleinschreibung! Die Berücksichtigung von Groß- und Kleinschreibung kann man erreichen mit: …oder über reguläre Ausdrücke: * Was macht der Tilde-Operator? Der Tilde-Operator kehrt eine Bit-Folge um, also 1 > 0 und 0 >…

    Read more

  • jQuery: prüfen, ob ein Elemtent sichtbar (visible) ist

    jQuery: prüfen, ob ein Elemtent sichtbar (visible) ist

    Written by

    in ,

    Verwendet man JQuery’s Effekte, wie beispielsweise JQuery.slideToggle(element), dann kann man die CSS-Eigenschaft visibility hier nicht nutzen, um zu ermitteln, ob das Element “ein- oder ausgeklappt” ist. Das Element ist dann möglicherweise ausgeblendet (minimiert), aber die Eigenschaft auf visibility:visible gesetzt.Wie lässt sich nun ermitteln, ob das Element ausgeblendet wurde? Folgender Code hilft weiter: oder

    Read more

  • jQuery: Unterschied zwischen $(document).ready und $(window).load

    Written by

    in ,

    jQuery bietet die Möglichkeit, Aktionen erst auszuführen, nachdem der Quelltext (DOM) der Webseite geladen wurde. Dies lässt sich mit folgendem Code realisieren: Und wozu dann $(window).load() ? Möchte man eine Aktion jedoch erst ausführen, nachdem auch alle Inhalte (Grafiken) geladen wurden, dann lässt sich dies mit folgenden Code erreichen:

    Read more