¡@

Home 

javascript Programming Glossary: demo

Delaying AngularJS route change until model loaded to prevent flicker

http://stackoverflow.com/questions/11972026/delaying-angularjs-route-change-until-model-loaded-to-prevent-flicker

until after all of the promises are resolved. Working demo http mhevery.github.com angular phonecat app # phones Source..

jQuery Mobile: Markup Enhancement of dynamically added content

http://stackoverflow.com/questions/14550396/jquery-mobile-markup-enhancement-of-dynamically-added-content

example http jsfiddle.net Gajotres w4m2B Here's a demo how to add dynamic navbar tab http jsfiddle.net Gajotres V6nHp.. And here's a working example with Google maps api3 demo http jsfiddle.net Gajotres 7kGdE This method can be used to.. Gajotres vTBGa Changes 01.02.2013 Added a dynamic navbar demo 01.03.2013 Added comment about how to dynamically add filtering..

Best way to detect when a user leaves a web page?

http://stackoverflow.com/questions/147636/best-way-to-detect-when-a-user-leaves-a-web-page

you to ask back if the user really wants to leave. See the demo onbeforeunload Demo . Alternatively you can send out an Ajax..

How do I “think in AngularJS” if I have a jQuery background?

http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background

often to create the component independently with a sample demo page against which our tests can perform DOM manipulation. So..

Unzip files using JavaScript

http://stackoverflow.com/questions/2095697/unzip-files-using-javascript

a new host soon. Included in the source is a ZipFile.htm demonstration page and 3 distinct scripts one for the zipfile class.. inflate class and one for a binary file reader class. The demo also depends on jQuery and jQuery UI. If you just download the.. what the application code looks like in Javascript In my demo this gets attached to a click event. it instantiates a ZipFile..

Create a file in memory for user to download, not through server

http://stackoverflow.com/questions/3665115/create-a-file-in-memory-for-user-to-download-not-through-server

jqgrid incorrect select drop down option values in edit box

http://stackoverflow.com/questions/4469650/jqgrid-incorrect-select-drop-down-option-values-in-edit-box

of dataUrl and buildSelect . I made the live example which demonstrate what you need. The main problem is that the value of.. select in some browsers are fixed The new version of the demo is here . The modified code of the demo you find below var countries.. new version of the demo is here . The modified code of the demo you find below var countries '1' 'US' '2' 'UK' allCountries..

Validate email address in JavaScript?

http://stackoverflow.com/questions/46155/validate-email-address-in-javascript

is probably the best way. Here's an example live demo function validateEmail email var re ^ ^ . s@ . ^ . s@ . @ 0..

How to disable scrolling temporarily?

http://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily

scroll and buttons associated with scrolling. Working demo left 37 up 38 right 39 down 40 spacebar 32 pageup 33 pagedown..

Accessing nested JavaScript objects with string key

http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key

Object.byString someObj 'part3 0 .name' See a working demo at http jsfiddle.net alnitak hEsys share improve this answer..

How to show popup message like in stackoverflow

http://stackoverflow.com/questions/659199/how-to-show-popup-message-like-in-stackoverflow

HTML table with fixed headers?

http://stackoverflow.com/questions/673153/html-table-with-fixed-headers

the original column widths below is the code. here's the demo Fixed Header Demo head script src http ajax.googleapis.com ajax..

how to bind fancybox to dynamic added element?

http://stackoverflow.com/questions/9081571/how-to-bind-fancybox-to-dynamic-added-element

as far as I know in most browsers including IE7 . See my demo page here UPDATE March 07 2012. I was told that this method.. inside the container where you applied the .on method. See demo The tabindex workaround for Chrome also applies. share improve..

How may I sort a list alphabetically using jQuery?

http://stackoverflow.com/questions/1134976/how-may-i-sort-a-list-alphabetically-using-jquery

How does an anonymous function in JavaScript work?

http://stackoverflow.com/questions/1140089/how-does-an-anonymous-function-in-javascript-work

test1 alerts 'function' because test2 is a function. Live Demo Compare this to function test1 alert typeof test1 alert typeof..

Simplest SOAP example using Javascript

http://stackoverflow.com/questions/124269/simplest-soap-example-using-javascript

sr send request ... script head body form name Demo action method post div input type button value Soap onclick..

contenteditable change events

http://stackoverflow.com/questions/1391278/contenteditable-change-events

How can I simulate a click to an anchor tag?

http://stackoverflow.com/questions/1421584/how-can-i-simulate-a-click-to-an-anchor-tag

'link2' Fake Click on Embedded Link button body html Demo here. It avoids recursion in non IE browsers by inspecting the..

Best way to detect when a user leaves a web page?

http://stackoverflow.com/questions/147636/best-way-to-detect-when-a-user-leaves-a-web-page

user really wants to leave. See the demo onbeforeunload Demo . Alternatively you can send out an Ajax request when he leaves...

Turn a number into star rating display using jQuery and CSS

http://stackoverflow.com/questions/1987524/turn-a-number-into-star-rating-display-using-jquery-and-css

stars 8 span Usage function 'span.stars' .stars Output Demo http www.ulmanen.fi stuff stars.php This will probably suit..

Executing <script> elements inserted with .innerHTML

http://stackoverflow.com/questions/2592092/executing-script-elements-inserted-with-innerhtml

how jQuery does it which resulted in the following code Demo div id element div script type text javascript function insertAndExecute..

Cross browsers mult-lines text overflow with ellipsis appended within a width&height fixed div?

http://stackoverflow.com/questions/3404508/cross-browsers-mult-lines-text-overflow-with-ellipsis-appended-within-a-widthhe

How to use underscore.js as a template engine?

http://stackoverflow.com/questions/4778881/how-to-use-underscore-js-as-a-template-engine

td td class f use to inject un sanitized user input see 'Demo of XSS hack' h3 item.name h3 p item.interests p td tr tbody.. calls sub templates fork it have a blast... JsFiddle Demo of XSS hack noted by @tarun_telang below share improve this..

Javascript equivalent of Python's zip function

http://stackoverflow.com/questions/4856717/javascript-equivalent-of-pythons-zip-function

_ i return arrays.map function array return array i Demo JSON.stringify zip 'abcde' 1 2 3 4 5 a 1 b 2 c 3 d 4 e 5 Or..

How to remove the space between inline-block elements?

http://stackoverflow.com/questions/5078239/how-to-remove-the-space-between-inline-block-elements

there will be a 4px wide space between the SPAN elements. Demo http jsfiddle.net dGHFV I understand why this happens and I.. .contents .filter function return this.nodeType 3 .remove Demo http jsfiddle.net dGHFV 1 But can this issue be solved with..

Zoom Canvas to Mouse Cursor

http://stackoverflow.com/questions/5189968/zoom-canvas-to-mouse-cursor

pt.x pt.y ctx.scale factor factor ctx.translate pt.x pt.y Demo http phrogz.net tmp canvas_zoom_to_cursor.html I've put up a..

placeholder in ie9

http://stackoverflow.com/questions/6366021/placeholder-in-ie9

jsPerf https github.com mathiasbynens jquery placeholder Demo Examples http mathiasbynens.be demo placeholder p.s I have used..

Insert html at caret in a contenteditable div

http://stackoverflow.com/questions/6690752/insert-html-at-caret-in-a-contenteditable-div

specifies whether or not to select the inserted content. Demo http jsfiddle.net timdown jwvha 527 Code function pasteHtmlAtCaret..

HTML table with fixed headers?

http://stackoverflow.com/questions/673153/html-table-with-fixed-headers

widths below is the code. here's the demo Fixed Header Demo head script src http ajax.googleapis.com ajax libs jquery 1.6.4..

Check checkbox checked property using jQuery

http://stackoverflow.com/questions/901712/check-checkbox-checked-property-using-jquery

What underlies this JavaScript idiom: var self = this?

http://stackoverflow.com/questions/962033/what-underlies-this-javascript-idiom-var-self-this

in the source for WebKit HTML 5 SQL Storage Notes Demo function Note var self this var note document.createElement..

How to detect Safari, Chrome, IE, Firefox and Opera browser?

http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser

install an extension. Use feature detection when possible. Demo http jsfiddle.net 9zxvE 383 var isOpera window.opera navigator.userAgent.indexOf..

What does “return false;” do?

http://stackoverflow.com/questions/10729198/what-does-return-false-do

bubbles to the div triggering it's submit handler. Live DEMO Now if the form submit's handler would cancel the bubbling with.. div wouldn't even know there was a form submission. Live DEMO What does return false do in vanilla javascript events return..

Why “$().ready(handler)” is not recommended?

http://stackoverflow.com/questions/10753306/why-readyhandler-is-not-recommended

jQuery object. Like regular selector 'a' .ready handler DEMO Nonsense selector 'fdhjhjkdafdsjkjriohfjdnfj' .ready handler.. selector 'fdhjhjkdafdsjkjriohfjdnfj' .ready handler DEMO Undefined selector .ready handler DEMO Finally... to my question.. .ready handler DEMO Undefined selector .ready handler DEMO Finally... to my question Why .ready handler is not recommended..

Can you have a javascript hook trigger after a DOM element's style object changes?

http://stackoverflow.com/questions/10868104/can-you-have-a-javascript-hook-trigger-after-a-dom-elements-style-object-change

Name to the callback. Thanks to @benvie for his feedback. DEMO http jsfiddle.net zFVyv 10 Tested in FF 12 Chrome 19 and IE..

Google Maps API Multiple Markers with Infowindows

http://stackoverflow.com/questions/11106671/google-maps-api-multiple-markers-with-infowindows

jQuery id selector works only for the first element

http://stackoverflow.com/questions/11114622/jquery-id-selector-works-only-for-the-first-element

Fancybox Imagemap Gallery

http://stackoverflow.com/questions/11299553/fancybox-imagemap-gallery

DOCTYPE though for validation purposes. UPDATE See working DEMO here NOTE Jan 15 2013 this demo will fail because is using jQuery..

How does an anonymous function in JavaScript work?

http://stackoverflow.com/questions/1140089/how-does-an-anonymous-function-in-javascript-work

definition. function msg alert msg 'SO' Above should work. DEMO Page http jsbin.com ujazi Code http jsbin.com ujazi edit I have..

Access / process (nested) objects, arrays or JSON

http://stackoverflow.com/questions/11922383/access-process-nested-objects-arrays-or-json

be a leaf node return node var first_leaf getLeaf root DEMO A more generic way to access a nested data structure with unknown.. recursive call else result.push value return result DEMO Helpers Since the structure of a complex object or array is..

Getting the position of the element in a list when it's drag/dropped (ui.sortable)

http://stackoverflow.com/questions/2442232/getting-the-position-of-the-element-in-a-list-when-its-drag-dropped-ui-sortabl

and drop position sortable share improve this question DEMO http goo.gl ursbd SOLUTION function 'ul#sortable' .sortable..

get average color of image via javascript

http://stackoverflow.com/questions/2541481/get-average-color-of-image-via-javascript

AFAIK the only way to do this is with canvas ... DEMO http jsfiddle.net xLF38 Note this will only work with images..

jQuery click / toggle between two functions

http://stackoverflow.com/questions/4911577/jquery-click-toggle-between-two-functions

tc this data.toggleclicked tc 1 2 return this jQuery DEMO Disclaimer I don't say this is the best implementation I bet..

Test if an element contains a class?

http://stackoverflow.com/questions/5898656/test-if-an-element-contains-a-class

class you are looking for is part of another class name. DEMO jQuery uses a similar if not the same method. Alternatively..

Using jQuery to replace one tag with another

http://stackoverflow.com/questions/7093417/using-jquery-to-replace-one-tag-with-another

this refers to the currently processed code element. DEMO Update There is no big performance difference but in case the..

Is “clear” a reserved word in Javascript?

http://stackoverflow.com/questions/7165570/is-clear-a-reserved-word-in-javascript

document.clear inside the event handler returns true . DEMO So it seems document is in the scope chain of the event handler......

how does jquery chaining work?

http://stackoverflow.com/questions/7475336/how-does-jquery-chaining-work

YouTube API Target (multiple) existing iframe(s)

http://stackoverflow.com/questions/8948403/youtube-api-target-multiple-existing-iframes

javascript api share improve this question TL DR DEMO http jsfiddle.net KtbYR 5 YT_ready getFrameID and onYouTubePlayerAPIReady..