Welcome To Snipplr


Everyone's Recent JavaScript Snippets Tagged DOM



« Prev 1 2
  1. FAV

    Merge or unmerge lists of items depending on window size

    For side by side ULs that become too wide on small screens/devices. The following script let you merge or unmerge ULs depending on the size of the screen/device. Works with jQuery
    JavaScript 5 views posted 6 years ago by jbernus
  2. FAV

    Dynamic Table Generator

    The use of dynamic data acquisition on modern web sites and in a lot of intranet applications, sometimes means we have to build structures dynamically as data comes in from a feed or AJAX operations. The problem is not with the data, but rather that...
    JavaScript 9 views posted 6 years ago by COBOLdinosaur
  3. FAV

    Javascript DOM Create Element

    Javascript DOM Create Element
    JavaScript 10 views posted 7 years ago by flamboyanz
  4. FAV

    Get DOM element via class and id selector, using Google Closure

    The Google Closure lets you get DOM elements with getElement( id ) and getElementByClass( class ). This function combines the two to let you get elements similarly to the way jQuery does. E.g. getElement( '#home .sidebar #links') returns the elemen...
    JavaScript 6 views posted 8 years ago by cjcenizal
  5. FAV

    Search for objects attached to the global JS object

    Simple recursive function to find objects that match the value of str hanging anywhere off the global JS object (window).
    JavaScript 3 views posted 8 years ago by richt
  6. FAV

    isEmail Function

    Check if user has intruded a real email address. Return true (real email) or false (fake email). Arguments: Element from a form. From book Dom Scripting by Jeremy Keith
    JavaScript 9 views posted 8 years ago by alberomo
  7. FAV

    isFilled (form element) Function

    Arguments: Element from a form. Take that element and checks if is filled. If not, returns false. If is filled, returns true. From book Dom Scripting by Jeremy Keith
    JavaScript 4 views posted 8 years ago by alberomo
  8. FAV

    focusLebels Function

    A JS function that put the focus in the form field associated to a label element whenever is clicked. The for atributte of the label element must match the id attribute of the associated form field. It takes no arguments. From book Dom Scripting by...
    JavaScript 3 views posted 8 years ago by alberomo
  9. FAV

    accessing the DOM of a page loaded in an iframe [javascript] [dom] [iframe] [for-twitter]

    JavaScript 7 views posted 8 years ago by Thammas
  10. FAV

    prototype check if element exists

    JavaScript 6 views posted 9 years ago by dmistriotis
  11. FAV

    Create new DOM element

    Thankfully, Sjoerd Visscher mentioned an interesting technique that could be used to force IE to use the specified CSS styling. Specifically, once you create a new DOM element (of the same name as the one in the document) all styling is applied. [.....
    JavaScript 2 views posted 9 years ago by stephcode
  12. FAV

    Check if DOM Element is Fully Visible

    JavaScript 6 views posted 9 years ago by iloveitaly
  13. FAV

    Javascript DOM - getElementsByClassName

    Similar to [Get Elements by Class Name]( http://snipplr.com/view/1696/get-elements-by-class-name/), but with optional "tag" parameter. Performance is increased by first retrieving the desired tag if available.
    JavaScript 5 views posted 9 years ago by jasonseney
  14. FAV

    SimpleSelector, Javascript DOM selector

    SimpleSelector is a small DOM selector object with support for the most used selectors. It's also the default selector for the jLim JavaScript framework. Why use SimpleSelector? - very small, less than 2kb minified - easy to use with $$() - no...
    JavaScript saved by 3 people 8 views posted 9 years ago by freelancephp
  15. FAV

    Javascript DOM - Create Element

    Basic create element and append it too another element.
    JavaScript 5 views posted 9 years ago by jasonseney
  16. FAV

    YUI - Determine when the DOM is ready to be used

    JavaScript 2 views posted 9 years ago by azulcm
  17. FAV

    Light (4kb mini-jQuery)

    JavaScript saved by 2 people 7 views posted 9 years ago by freelancephp
  18. FAV

    getElementBySimilarId

    A simple, non-recursive function that I use to return the first element with an ID that contains a certain ID string. Sometimes, APS.NET appends the Naming Container ID to the IDs of controls, and in instances where the ClientID of a control you wa...
    JavaScript 1 views posted 10 years ago by erintechspired
  19. FAV

    JS screen & browser dimensions

    pretty basic; dimensions of screen and browser display window
    JavaScript 2 views posted 10 years ago by rwczippy
  20. FAV

    View IE generated source

    Go to page, then place code in address bar and generated code will be shown in new window.
    JavaScript saved by 2 people 2 views posted 10 years ago by bionic
  21. FAV

    Disable and enable a text input in Firefox

    I just noticed in Firefox 3.5.2 that setting `disabled = true` for a focused text input seems to make it impossible to re-focus after setting `disabled = false`. The solution is to blur it before disabling.
    JavaScript 4 views posted 10 years ago by cyberhobo
  22. FAV

    Focus first 'focus'able form field on load (DOM)

    Usage: //any element window.onload = function(){ focusFirstInput(); } or // form elements under 'content-body' window.onload = function(){ focusFirstInput('content-body'); }
    JavaScript 3 views posted 10 years ago by neoprolog
  23. FAV

    jQuery bookmarklet: find duplicate ID's on the page

    <a href="javascript:(function(){var%20ids=[];jQuery('*').each(function(){if(this.id&&this.id!==''){if(ids[this.id]){console.log('duplicate%20id%20found:%20'+this.id,this,ids[this.id])}else{ids[this.id]=this}}});})();">Find duplicate IDs</a> (drag me...
    JavaScript saved by 2 people 5 views posted 10 years ago by krunkosaurus
  24. FAV

    getComputedStyle for IE

    fix for IE, adds getComputedStyle method for the object window and getPropertyValue method for the object, which returns getComputedStyle
    JavaScript saved by 3 people 15 views posted 10 years ago by Jman
  25. FAV

    Find Viewport Height / Width, crossbrowser:

    A little bit of browser detection and some functions to get the viewport height and width, crossbrowser.
    JavaScript saved by 2 people 7 views posted 10 years ago by ShiftyP
  26. FAV

    Exception manager for DOM event handlers - no more silent failures

    It is utterly annoying when DOM event handler exceptions fail silently with Firebug. This package fixes this common problem.
    JavaScript 1 views posted 11 years ago by miohtama
  27. FAV

    DOM Scripting vs jQuery 4: Row Highlighting

    JavaScript saved by 3 people 4 views posted 11 years ago by demixo
  28. FAV

    DOM Scripting vs jQuery 3: Añadir una clase

    JavaScript 2 views posted 11 years ago by demixo
  29. FAV

    DOM Scripting vs jQuery 2: Acceso a elementos y eventos

    JavaScript 3 views posted 11 years ago by demixo
  30. FAV

    DOM Scripting vs jQuery 1: "Hola mundo"

    JavaScript saved by 3 people 5 views posted 11 years ago by demixo
« Prev 1 2