Welcome To Snipplr


Everyone's Recent JavaScript Snippets Tagged DOM



« Prev 1 2
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
0 84 posted 7 years ago by jbernus
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...
0 78 posted 7 years ago by COBOLdinosaur
Javascript DOM Create Element
0 68 posted 7 years ago by flamboyanz
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...
0 124 posted 8 years ago by cjcenizal
Simple recursive function to find objects that match the value of str hanging anywhere off the global JS object (window).
0 99 posted 8 years ago by richt
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
0 123 posted 8 years ago by alberomo
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
0 115 posted 8 years ago by alberomo
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...
0 50 posted 8 years ago by alberomo
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. [.....
0 85 posted 9 years ago by stephcode
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.
0 57 posted 10 years ago by jasonseney
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...
1 104 posted 10 years ago by freelancephp
Basic create element and append it too another element.
0 59 posted 10 years ago by jasonseney
1 93 posted 10 years ago by freelancephp
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...
0 36 posted 10 years ago by erintechspired
pretty basic; dimensions of screen and browser display window
0 59 posted 10 years ago by rwczippy
Go to page, then place code in address bar and generated code will be shown in new window.
1 63 posted 10 years ago by bionic
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.
0 91 posted 10 years ago by cyberhobo
Usage: //any element window.onload = function(){ focusFirstInput(); } or // form elements under 'content-body' window.onload = function(){ focusFirstInput('content-body'); }
0 69 posted 10 years ago by neoprolog
<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...
1 94 posted 11 years ago by krunkosaurus
fix for IE, adds getComputedStyle method for the object window and getPropertyValue method for the object, which returns getComputedStyle
1 406 posted 11 years ago by Jman
A little bit of browser detection and some functions to get the viewport height and width, crossbrowser.
1 149 posted 11 years ago by ShiftyP
It is utterly annoying when DOM event handler exceptions fail silently with Firebug. This package fixes this common problem.
0 76 posted 11 years ago by miohtama
« Prev 1 2