¡@

Home 

2014/10/16 ¤W¤È 12:03:05

jquery Programming Glossary: e.g

Equivalent of String.format in JQuery

http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery

equivalents in MicrosoftAjax of the popular .net methods e.g. String.format String.startsWith .. etc are there equivalents..

Why does jQuery or a DOM method such as `getElementById` not find the element?

http://stackoverflow.com/questions/14028959/why-does-jquery-or-a-dom-method-such-as-getelementbyid-not-find-the-element

the jQuery file was found and correct the URL if it wasn't e.g. add the http or https scheme at the beginning adjust the path..

using jquery $.ajax to call a PHP function

http://stackoverflow.com/questions/2269307/using-jquery-ajax-to-call-a-php-function

corresponding value should point to the method to invoke e.g. if isset _POST 'action' empty _POST 'action' action _POST 'action'..

Difference between jQuery `click`, `bind`, `live`, `delegate`, `trigger` and `on` functions (with an example)?

http://stackoverflow.com/questions/2954932/difference-between-jquery-click-bind-live-delegate-trigger-and-on

weren't there when this code was run to attach the handler e.g. the selector found it then won't get the handler. .live and.. the same way. You use these when your elements may change e.g. adding new rows list items etc. If you don't have a parent.. event handler but not the default action most of the time e.g. placing the cursor at the right spot in a clicked textarea..

Window.onload vs document.ready ?

http://stackoverflow.com/questions/3698200/window-onload-vs-document-ready

while the onload event occurs later when all content e.g. images also has been loaded. The onload event is a standard..

Rotating a Div Element in jQuery

http://stackoverflow.com/questions/382591/rotating-a-div-element-in-jquery

rotate 0 function rotate degree For webkit browsers e.g. Chrome elie.css WebkitTransform 'rotate ' degree 'deg ' For.. 'rotate ' degree 'deg ' For Mozilla browser e.g. Firefox elie.css ' moz transform' 'rotate ' degree 'deg ' ..

What is the need of JSF. When UI can be achieved from css html javascript jQuery?

http://stackoverflow.com/questions/4421839/what-is-the-need-of-jsf-when-ui-can-be-achieved-from-css-html-javascript-jquery

the JSF view state in the server side into account as well e.g. enabling a disabled button in JS side won't enable the button..

What is console.log?

http://stackoverflow.com/questions/4539253/what-is-console-log

clicked in Firebug ™s œConsole tab or another tool ™s console e.g. Chrome ™s Web Inspector when you would click the button. edit..

Getting the ID of the element that fired an event using jQuery

http://stackoverflow.com/questions/48239/getting-the-id-of-the-element-that-fired-an-event-using-jquery

function on it then you must refer to it as ' this ' e.g. document .ready function a .click function event this.append..

jQuery - setting the selected value of a select control via its text description

http://stackoverflow.com/questions/496052/jquery-setting-the-selected-value-of-a-select-control-via-its-text-description

don't have . I know setting it by value is pretty trivial. e.g. #my select .val myVal But I'm a bit stumped on doing it via..

Manipulating CSS pseudo-elements using jQuery (e.g. :before and :after)

http://stackoverflow.com/questions/5041494/manipulating-css-pseudo-elements-using-jquery-e-g-before-and-after

CSS pseudo elements using jQuery e.g. before and after Is there any way to select manipulate CSS..

Get the Highlighted/Selected text

http://stackoverflow.com/questions/5379120/get-the-highlighted-selected-text

to get the highlighted text in a paragraph of a website e.g. by using jQuery javascript jquery share improve this question..

Does using $this instead of $(this) provide a performance enhancement?

http://stackoverflow.com/questions/5724400/does-using-this-instead-of-this-provide-a-performance-enhancement

DOM object is repeatedly passed to the jQuery constructor e.g. 'p' . As for the use of var again always use var to declare..

JQuery, Spring MVC @RequestBody and JSON - making it work together

http://stackoverflow.com/questions/5908466/jquery-spring-mvc-requestbody-and-json-making-it-work-together

the Java to JSON to JQuery path... @ResponseBody e.g. @RequestMapping value fooBar id method RequestMethod.GET public.. 'fooBar 1' function data do something this works well e.g. annotations work already thanks to all the answerers However..

What's the difference between jQuery .live() and .on()

http://stackoverflow.com/questions/8042576/whats-the-difference-between-jquery-live-and-on

with other event methods in ways that can be surprising e.g. document .unbind click removes all click handlers attached..

Origin null is not allowed by Access-Control-Allow-Origin

http://stackoverflow.com/questions/8456538/origin-null-is-not-allowed-by-access-control-allow-origin

the HTML page that does the load call via a file URL e.g. just double clicking it in a local file browser or similar..

Determine whether user clicking scrollbar or content (onclick for native scroll bar)

http://stackoverflow.com/questions/10045423/determine-whether-user-clicking-scrollbar-or-content-onclick-for-native-scroll

rX x y return bInX bInY Are all scrollbar sizes uniform E.g in Firefox and IE it's 18px. Assuming there are no customized..

How do I add a simple jquery script to wordpress?

http://stackoverflow.com/questions/11159860/how-do-i-add-a-simple-jquery-script-to-wordpress

'js'. Create a file in that folder for your javascript. E.g. your script.js. Add your jQuery script to that file you don't..

Difference Between Observers and Watchers

http://stackoverflow.com/questions/14876112/difference-between-observers-and-watchers

a DOM attribute that contains interpolation i.e. 's . E.g. attr1 Name name then in a directive attrs. observe 'attr1'.. when you want to observe watch a model scope property. E.g. attr1 myModel.some_prop then in a controller or link function.. functions. Sometimes you don't need observe or watch. E.g. if your attribute contains a number or a boolean not a string..

Can I load external stylesheets on request?

http://stackoverflow.com/questions/2126238/can-i-load-external-stylesheets-on-request

it to the head tag the browser will load that stylesheet. E.g. 'head' .append ' link rel stylesheet type text css href lightbox_stylesheet.css..

jQuery Ajax File Upload

http://stackoverflow.com/questions/2320069/jquery-ajax-file-upload

UPDATE With XHR2 File upload through AJAX is supported. E.g. through FormData object but unfortunately it is not supported..

jQuery fadeIn fadeOut - IE8 does not fade

http://stackoverflow.com/questions/2766735/jquery-fadein-fadeout-ie8-does-not-fade

following css attributes opacity inherit filter inherit E.g div img id 'myImg' src 'http mydomain.com' style 'position absolute..

jquery .html() vs .append()

http://stackoverflow.com/questions/3015335/jquery-html-vs-append

of cross browser checks and various other optimisations. E.g. if you pass just div div to jQuery jQuery will take a shortcut.. loop creating a new jQuery object on every iteration. E.g. the quickest way to create 100 divs with jQuery jQuery Array..

Is there a jquery event that fires when a new node is inserted into the dom?

http://stackoverflow.com/questions/3900151/is-there-a-jquery-event-that-fires-when-a-new-node-is-inserted-into-the-dom

fires on a dom element when it is inserted into the dom E.g. lets say I load some content via ajax and add it to the DOM..

Get list of data-* attributes using javascript / jQuery

http://stackoverflow.com/questions/4187032/get-list-of-data-attributes-using-javascript-jquery

can one retrieve a list of key value pairs for the data. E.g. given this div id 'prod' data id '10' data cat 'toy' data cid..

jQuery UI Dialog instead of alert() for Rails 3 data-confirm attribute

http://stackoverflow.com/questions/4421072/jquery-ui-dialog-instead-of-alert-for-rails-3-data-confirm-attribute

it can be modified or swapped out even more easily now. E.g. .rails.confirm function message return myConfirmDialog message..

Best JavaScript solution for client-side form validation and interaction?

http://stackoverflow.com/questions/4751780/best-javascript-solution-for-client-side-form-validation-and-interaction

. Side effects Some fields have side effects when updated. E.g. updating the price or quantity of an item needs to update a.. fields are hidden and have values populated by widgets. E.g. a map widget lets you point to a location and a hidden field.. multiple forms in order from the same page using Ajax. E.g. we let users sign up and create a widget in one swoop but due..

Allow Google Chrome to use XMLHttpRequest to load a URL from a local file

http://stackoverflow.com/questions/4819060/allow-google-chrome-to-use-xmlhttprequest-to-load-a-url-from-a-local-file

which are from a local file to a URL on the Internet. E.g. .get 'http www.google.com ' fails when executing in a local..

Efficient, concise way to find next matching sibling?

http://stackoverflow.com/questions/4933236/efficient-concise-way-to-find-next-matching-sibling

to do that so be it but that's not what this question is. E.g given this structure div One div div class 'foo' Two div div..

jQuery.getJSON - Access-Control-Allow-Origin Issue

http://stackoverflow.com/questions/6396623/jquery-getjson-access-control-allow-origin-issue

the JSON in JavaScript code that would call that function. E.g. if your current JSON response is weather Dreary start but soon..

jQuery Mobile lock orientation

http://stackoverflow.com/questions/7009743/jquery-mobile-lock-orientation

Is there a possibility to lock the orientation on one page E.g. page map is loaded and the orientation is locked to landscape..

Equivalent of String.format in JQuery

http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery

code from MicrosoftAjax to JQuery. I use the javascript equivalents in MicrosoftAjax of the popular .net methods e.g. String.format String.startsWith .. etc are there equivalents to them in JQuery Thanks javascript jquery microsoft ajax..

Why does jQuery or a DOM method such as `getElementById` not find the element?

http://stackoverflow.com/questions/14028959/why-does-jquery-or-a-dom-method-such-as-getelementbyid-not-find-the-element

Use the browser's developer tools to find out whether the jQuery file was found and correct the URL if it wasn't e.g. add the http or https scheme at the beginning adjust the path etc. Listening to the load DOMContentLoaded events is exactly..

using jquery $.ajax to call a PHP function

http://stackoverflow.com/questions/2269307/using-jquery-ajax-to-call-a-php-function

server side the action POST parameter should be read and the corresponding value should point to the method to invoke e.g. if isset _POST 'action' empty _POST 'action' action _POST 'action' switch action case 'test' test break case 'blah' blah..

Difference between jQuery `click`, `bind`, `live`, `delegate`, `trigger` and `on` functions (with an example)?

http://stackoverflow.com/questions/2954932/difference-between-jquery-click-bind-live-delegate-trigger-and-on

this handler won't be there anymore. Also elements that weren't there when this code was run to attach the handler e.g. the selector found it then won't get the handler. .live and .delegate are similarly related .delegate actually uses .live.. This works for new and old elements they bubble events the same way. You use these when your elements may change e.g. adding new rows list items etc. If you don't have a parent common ancestor that will stay in the page and not be replaced.. shortcuts here . As for the difference .trigger triggers the event handler but not the default action most of the time e.g. placing the cursor at the right spot in a clicked textarea . It causes the event handlers to occur in the order they were..

Window.onload vs document.ready ?

http://stackoverflow.com/questions/3698200/window-onload-vs-document-ready

The ready event occurs after the HTML document has been loaded while the onload event occurs later when all content e.g. images also has been loaded. The onload event is a standard event in the DOM while the ready event is specific to jQuery...

Rotating a Div Element in jQuery

http://stackoverflow.com/questions/382591/rotating-a-div-element-in-jquery

started and stopped function var elie selectorForElementsToRotate rotate 0 function rotate degree For webkit browsers e.g. Chrome elie.css WebkitTransform 'rotate ' degree 'deg ' For Mozilla browser e.g. Firefox elie.css ' moz transform' 'rotate.. rotate degree For webkit browsers e.g. Chrome elie.css WebkitTransform 'rotate ' degree 'deg ' For Mozilla browser e.g. Firefox elie.css ' moz transform' 'rotate ' degree 'deg ' Animate rotation with a recursive call setTimeout function rotate..

What is the need of JSF. When UI can be achieved from css html javascript jQuery?

http://stackoverflow.com/questions/4421839/what-is-the-need-of-jsf-when-ui-can-be-achieved-from-css-html-javascript-jquery

Adding custom JS code isn't that easy as you have to take the JSF view state in the server side into account as well e.g. enabling a disabled button in JS side won't enable the button in JSF side which is in turn a huge security advantage ...

What is console.log?

http://stackoverflow.com/questions/4539253/what-is-console-log

was clicked' do something You'd then see #someButton was clicked in Firebug ™s œConsole tab or another tool ™s console e.g. Chrome ™s Web Inspector when you would click the button. edit as Baptiste Pernet showed in his answer you could first check..

Getting the ID of the element that fired an event using jQuery

http://stackoverflow.com/questions/48239/getting-the-id-of-the-element-that-fired-an-event-using-jquery

but that it is not a jQuery object so if you wish to use a jQuery function on it then you must refer to it as ' this ' e.g. document .ready function a .click function event this.append wouldn't work this .append Clicked share improve this answer..

jQuery - setting the selected value of a select control via its text description

http://stackoverflow.com/questions/496052/jquery-setting-the-selected-value-of-a-select-control-via-its-text-description

the text description I have as opposed to the value which I don't have . I know setting it by value is pretty trivial. e.g. #my select .val myVal But I'm a bit stumped on doing it via the text description. I guess there must be a way of getting..

Manipulating CSS pseudo-elements using jQuery (e.g. :before and :after)

http://stackoverflow.com/questions/5041494/manipulating-css-pseudo-elements-using-jquery-e-g-before-and-after

CSS pseudo elements using jQuery e.g. before and after Is there any way to select manipulate CSS pseudo elements such as before and after using jQuery For example..

Get the Highlighted/Selected text

http://stackoverflow.com/questions/5379120/get-the-highlighted-selected-text

the Highlighted Selected text Is it possible to get the highlighted text in a paragraph of a website e.g. by using jQuery javascript jquery share improve this question Getting the text the user has selected is relatively..

Does using $this instead of $(this) provide a performance enhancement?

http://stackoverflow.com/questions/5724400/does-using-this-instead-of-this-provide-a-performance-enhancement

performance impacts arise is when a selector rather than a DOM object is repeatedly passed to the jQuery constructor e.g. 'p' . As for the use of var again always use var to declare new variables. By doing so the variable will only be accessible..

JQuery, Spring MVC @RequestBody and JSON - making it work together

http://stackoverflow.com/questions/5908466/jquery-spring-mvc-requestbody-and-json-making-it-work-together

a bidirectional JSON to Java serialization I'm using successfully the Java to JSON to JQuery path... @ResponseBody e.g. @RequestMapping value fooBar id method RequestMethod.GET public @ResponseBody FooBar getFooBar @PathVariable String id.. application json ... and In JQuery I use .getJSON 'fooBar 1' function data do something this works well e.g. annotations work already thanks to all the answerers However how do I do the reverse path have JSON be serialized to a..

What's the difference between jQuery .live() and .on()

http://stackoverflow.com/questions/8042576/whats-the-difference-between-jquery-live-and-on

Origin null is not allowed by Access-Control-Allow-Origin

http://stackoverflow.com/questions/8456538/origin-null-is-not-allowed-by-access-control-allow-origin

is the local file system so that suggests that you're loading the HTML page that does the load call via a file URL e.g. just double clicking it in a local file browser or similar . Different browsers take different approaches to applying the..

Determine whether user clicking scrollbar or content (onclick for native scroll bar)

http://stackoverflow.com/questions/10045423/determine-whether-user-clicking-scrollbar-or-content-onclick-for-native-scroll

rX.left e.width if hasY rX.right scrollSize bInX inRect rX x y return bInX bInY Are all scrollbar sizes uniform E.g in Firefox and IE it's 18px. Assuming there are no customized scrollbars is there any extra padding or sizes in some browsers..

How do I add a simple jquery script to wordpress?

http://stackoverflow.com/questions/11159860/how-do-i-add-a-simple-jquery-script-to-wordpress

In your theme folder create a folder called something like 'js'. Create a file in that folder for your javascript. E.g. your script.js. Add your jQuery script to that file you don't need script tags in a .js file . Here is an example of how..

Difference Between Observers and Watchers

http://stackoverflow.com/questions/14876112/difference-between-observers-and-watchers

inside directives. Use observe when you need to observe watch a DOM attribute that contains interpolation i.e. 's . E.g. attr1 Name name then in a directive attrs. observe 'attr1' ... . If you try scope. watch attrs.attr1 ... it won't work.. are evaluated as Angular expressions watch is often used when you want to observe watch a model scope property. E.g. attr1 myModel.some_prop then in a controller or link function scope. watch 'myModel.some_prop' ... or scope. watch attrs.attr1.. operation. And this is why we need the observe and watch functions. Sometimes you don't need observe or watch. E.g. if your attribute contains a number or a boolean not a string just evaluate it once attr1 22 then in say your linking function..

Can I load external stylesheets on request?

http://stackoverflow.com/questions/2126238/can-i-load-external-stylesheets-on-request

Yup if you create a link tag linking to a stylesheet and add it to the head tag the browser will load that stylesheet. E.g. 'head' .append ' link rel stylesheet type text css href lightbox_stylesheet.css ' However as per @peteorpeter ™s comments..

jQuery Ajax File Upload

http://stackoverflow.com/questions/2320069/jquery-ajax-file-upload

jQuery fadeIn fadeOut - IE8 does not fade

http://stackoverflow.com/questions/2766735/jquery-fadein-fadeout-ie8-does-not-fade

Simply set the absolute relative positioned elements the following css attributes opacity inherit filter inherit E.g div img id 'myImg' src 'http mydomain.com' style 'position absolute top 10px left 5px filter inherit opacity inherit' div..

jquery .html() vs .append()

http://stackoverflow.com/questions/3015335/jquery-html-vs-append

a lot more complicated than that as jQuery does a bunch of cross browser checks and various other optimisations. E.g. if you pass just div div to jQuery jQuery will take a shortcut and simply do document.createElement 'div' . EDIT To see.. elements then the last thing you want to do is create a massive loop creating a new jQuery object on every iteration. E.g. the quickest way to create 100 divs with jQuery jQuery Array 101 .join ' div div ' There are also issues of readability..

Is there a jquery event that fires when a new node is inserted into the dom?

http://stackoverflow.com/questions/3900151/is-there-a-jquery-event-that-fires-when-a-new-node-is-inserted-into-the-dom

a new node is inserted into the dom Is there an event jquery fires on a dom element when it is inserted into the dom E.g. lets say I load some content via ajax and add it to the DOM and in some other piece of javascript I could add an event..

Get list of data-* attributes using javascript / jQuery

http://stackoverflow.com/questions/4187032/get-list-of-data-attributes-using-javascript-jquery

arbitrary HTML element with zero or more data attributes how can one retrieve a list of key value pairs for the data. E.g. given this div id 'prod' data id '10' data cat 'toy' data cid '42' blah div I would like to be able to programmatically..

jQuery UI Dialog instead of alert() for Rails 3 data-confirm attribute

http://stackoverflow.com/questions/4421072/jquery-ui-dialog-instead-of-alert-for-rails-3-data-confirm-attribute

Best JavaScript solution for client-side form validation and interaction?

http://stackoverflow.com/questions/4751780/best-javascript-solution-for-client-side-form-validation-and-interaction

enters 5 into a price field the field is updated to 5.00 . Side effects Some fields have side effects when updated. E.g. updating the price or quantity of an item needs to update a subtotal field. Widget driven elements Some fields are hidden.. needs to update a subtotal field. Widget driven elements Some fields are hidden and have values populated by widgets. E.g. a map widget lets you point to a location and a hidden field is updated with latitude longitude coordinates but the location.. to be more versatile than binding to onSubmit we sometimes post multiple forms in order from the same page using Ajax. E.g. we let users sign up and create a widget in one swoop but due to legacy systems that flow requires two POST requests. Customizable..

Allow Google Chrome to use XMLHttpRequest to load a URL from a local file

http://stackoverflow.com/questions/4819060/allow-google-chrome-to-use-xmlhttprequest-to-load-a-url-from-a-local-file

if there is any way to make Google Chrome allow these requests which are from a local file to a URL on the Internet. E.g. .get 'http www.google.com ' fails when executing in a local file but I've scripted the page myself and I'm using it myself..

Efficient, concise way to find next matching sibling?

http://stackoverflow.com/questions/4933236/efficient-concise-way-to-find-next-matching-sibling

Sizzle adding a plug in into the mix etc. If I end up having to do that so be it but that's not what this question is. E.g given this structure div One div div class 'foo' Two div div Three div div class 'foo' Four div div Five div div Six div..

jQuery.getJSON - Access-Control-Allow-Origin Issue

http://stackoverflow.com/questions/6396623/jquery-getjson-access-control-allow-origin-issue

for a query string parameter called callback and wraps the JSON in JavaScript code that would call that function. E.g. if your current JSON response is weather Dreary start but soon brightening into a fine summer day. Your script would look..

jQuery Mobile lock orientation

http://stackoverflow.com/questions/7009743/jquery-mobile-lock-orientation

and jquery mobile to build an app for an android phone. Is there a possibility to lock the orientation on one page E.g. page map is loaded and the orientation is locked to landscape mode. jquery jquery mobile phonegap orientation landscape..