Welcome To Snipplr


Everyone's Recent JavaScript Snippets



« Prev 1 2 3 4 5 ... 67
  1. FAV

    Read Javascript questions for interview with example

    JavaScript is a client-side as well as server side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object based Programming language. Example Note: This is an example, you can change...
    JavaScript 151 views posted 2 months ago by priyagchaudhary
  2. FAV

    Drop-down menu does not work on mobile devices

    It works for me
    JavaScript 151 views posted 5 months ago by cerxx
  3. FAV

    JQuery - how to wait for the \"end\" of the \"resize\" event and only then perform the action?

    The resizeend event. It works for me
    JavaScript 148 views posted 5 months ago by cerxx
  4. FAV

    How do I set/unset a cookie with JavaScript

    There is no need to use jQuery particularly to manipulate cookies.
    JavaScript 156 views posted 5 months ago by cerxx
  5. FAV

    Get User IP By jQuery Ajax

    Get User IP By jQuery Ajax
    JavaScript 156 views posted 5 months ago by cerxx
  6. FAV

    Click on iOs and Android

    Here is a code that force to fire a click on iOS devices, where there is first a touchstart event
    JavaScript 17 views posted 6 months ago by cerxx
  7. FAV

    JavaScript IP validation

    JavaScript regex for validating IP addresses, has been tested!
    JavaScript 12 views posted 1 year ago by plasticbottle
  8. FAV

    Display Random Quotes with JavaScript

    This snippet code allows you to prevent the viewer from being able to right-click on your page. This can discourage the average user from borrow images or code from your site.
    JavaScript 15 views posted 2 years ago by apphp-snippets
  9. FAV

    Decimal to binary converter

    A one-liner that converts a decimal number to a binary number
    JavaScript 14 views posted 3 years ago by rm1984
  10. FAV

    React: Pass value to method from onClick

    How to pass a parameter into a method from an onClick method found in the render method. Majority of the times when you need to do this, your adding it through a loop. In this case, call a function where the item in the loop will automatically be...
    JavaScript 8 views posted 3 years ago by heathbo
  11. FAV

    Detect the OS of mobile device

    Detect the OS of mobile device
    JavaScript 15 views posted 3 years ago by envane21
  12. FAV

    Bootstrap javascript breakpoint utils

    ResponsiveBootstrapToolkit : https://github.com/maciej-gurban/responsive-bootstrap-toolkit
    JavaScript 12 views posted 4 years ago by dhjapan
  13. FAV

    Button text on wrong answer

    change the button text on wrong answer
    JavaScript 10 views posted 4 years ago by envane21
  14. FAV

    Dynamics CRM 2011 Filter Subgrid and Refresh

    Filters a dynamics CRM 2011 subgrid...implementation example included at bottom
    JavaScript 14 views posted 4 years ago by skinnymoore
  15. FAV

    React: Get width, height, and coordinates of a react object

    Use ref with getDOMNode() to get the actual html. Using getBoundingClientRect() on the actual html will give you the width, height, etc. Below: specs = ClientRect {} bottom: 269 height: 18 left: 797.546875 right: 1062.609375 top: 251 width: 2...
    JavaScript 18 views posted 4 years ago by heathbo
  16. FAV

    React: How to access returned HTML within a React Component

    Within a react component. How to gain access to the HTML that was just rendered. Any returned html element that is tagged with a ref, can easily be accessed by it's ref after it's been rendered. In the below case, use this.refs["domainModal"] to...
    JavaScript 13 views posted 4 years ago by heathbo
  17. FAV

    Codepad.co - Set Default Language to JavaScript.js Last active 11 minutes ago

    When creating a new https://codepad.co/ snippet, the default language will be set to 'JavaScript'.
    JavaScript 9 views posted 4 years ago by avansare
  18. FAV

    Anti iFrame Buster in JavaScript

    You know that iFrames are a necessary evil for many of us. When yuo put a third party site in an iframe is always a risk because they can break out of that iframe and redirect the visitor to another location. This code acts as a defense for such case...
    JavaScript 10 views posted 4 years ago by apphp-snippets
  19. FAV

    Getting IP Address

    Sometimes you may want to show the visitor that you are aware of their IP address. You can do so by using few lines of code as shown here. Place the code in any place of your page, where you want the IP address to appear:
    JavaScript 10 views posted 4 years ago by apphp-snippets
  20. FAV

    Check if checkbox is checked

    Check if the checkbox is checked or not on button click
    JavaScript 18 views posted 4 years ago by envane21
  21. FAV

    forEach. How to break?

    Array.prototype.forEach You can't break forEach. So use "some" or "every". Array.prototype.some some is pretty much the same as forEach but it break when the callback returns true. Array.prototype.every every is almost identical to some except i...
    JavaScript 11 views posted 4 years ago by Waltem
  22. FAV

    Remove an item from array using UnderscoreJS

    Using underscore.js, you could combine .findWhere with .without Although, since you are creating a new array in this case anyway, you could simply use _.filter or the native Array.prototype.filter function (just like shown in the other question)....
    JavaScript 34 views posted 4 years ago by Balamir
  23. FAV

    JS - debug console log logger error, warn, info, log, debug

    // create a variable to toggle debugging // to use it, just call debug(with,any,optional,parameters) debug(x,y,z); // it will try to guess what type of message to log, or you can specify in the first parameter debug("error",x,y,z);
    JavaScript saved by 9 people 9 views posted 4 years ago by brandonjp
  24. FAV

    Verify email address

    Allows for forname.o'[email protected]
    JavaScript 13 views posted 4 years ago by flatearthcomms
  25. FAV

    Copy object by value instead of by reference

    To do this for any object in JavaScript will not be simple or straightforward. You will run into the problem of erroneously picking up attributes from the object's prototype that should be left in the prototype and not copied to the new instance. If,...
    JavaScript 11 views posted 4 years ago by BrentS
  26. FAV

    delete Operator don’t impact the length of Array in JavaScript

    delete Operator don’t impact the length of Array in JavaScript
    JavaScript saved by 9 people 10 views posted 4 years ago by ursdeep
  27. FAV

    Caoturing the Mouse Position

    The key to making it work is the event listener that get added using the DOM method that binds it to the mousemove event and declares the event handler. Most event can be bound to a handler this way.
    JavaScript 14 views posted 4 years ago by COBOLdinosaur
  28. FAV

    Javascript Screen Resolutions

    Get your screen resolution use JavaScript
    JavaScript 11 views posted 4 years ago by BebenKoben
  29. FAV

    Check if jquery was loaded from CDN

    Check if jquery was loaded from CDN. If not, load it from own website.
    JavaScript 15 views posted 5 years ago by a1ias
  30. FAV

    EnjoyHint 3.0 To Add Free Hints and Tips To Site Or App

    The new updated introduced auto scrolling to highlighted elements, possibility to hide 'next' and 'skip' buttons, add html markup in description, and more.
    JavaScript 25 views posted 5 years ago by lanagio
« Prev 1 2 3 4 5 ... 67