jquery Programming Glossary: foo
jQueryUI: how can I custom-format the Autocomplete plug-in results? http://stackoverflow.com/questions/2435964/jqueryui-how-can-i-custom-format-the-autocomplete-plug-in-results sequence in drop down results For example if I have data foo bar it and I search for foo I get foo bar in drop down. jquery.. For example if I have data foo bar it and I search for foo I get foo bar in drop down. jquery jquery ui autocomplete jquery.. if I have data foo bar it and I search for foo I get foo bar in drop down. jquery jquery ui autocomplete jquery autocomplete..
How to get the current URL in javascript? http://stackoverflow.com/questions/406192/how-to-get-the-current-url-in-javascript it to a variable Example URL http localhost menuname.de foo bar amp number 0 javascript jquery url path share improve..
jQuery Ajax POST example with php http://stackoverflow.com/questions/5004233/jquery-ajax-post-example-with-php form to a database. Here is the form I am using form name foo action form.php method POST id foo label for bar A bar label.. I am using form name foo action form.php method POST id foo label for bar A bar label input id bar name bar type text value.. usage of .ajax would look something like this HTML form id foo label for bar A bar label input id bar name bar type text value..
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 my stylesheet has a rule stating... .span after content 'foo' How can I change 'foo' to 'bar' using jQuery javascript jquery.. stating... .span after content 'foo' How can I change 'foo' to 'bar' using jQuery javascript jquery html css pseudo element.. and then use jQuery to manipulate that In HTML span foo span In jQuery script 'span' .hover function this .attr 'data..
jQuery Data vs Attr? http://stackoverflow.com/questions/7261619/jquery-data-vs-attr the server you should set the data on the element a id foo data foo bar href # foo a The data can then be accessed using.. you should set the data on the element a id foo data foo bar href # foo a The data can then be accessed using .data in.. set the data on the element a id foo data foo bar href # foo a The data can then be accessed using .data in jQuery console.log..
Find object by id in array of javascript objects http://stackoverflow.com/questions/7364150/find-object-by-id-in-array-of-javascript-objects javascript objects I've got an array myArray 'id' '73' 'foo' 'bar' 'id' '45' 'foo' 'bar' etc. I'm unable to change the structure.. I've got an array myArray 'id' '73' 'foo' 'bar' 'id' '45' 'foo' 'bar' etc. I'm unable to change the structure of the array... and that it only occurs once you can just use result 0 .foo to get the value. Otherwise you should check the length of the..
How to select PrimeFaces UI or JSF components using jQuery? http://stackoverflow.com/questions/7927716/how-to-select-primefaces-ui-or-jsf-components-using-jquery as default separator character. So for example h form id foo p selectManyCheckbox id bar ... will end up in generated HTML.. id bar ... will end up in generated HTML as form id foo name foo input type checkbox id foo bar name foo bar ... You.. bar ... will end up in generated HTML as form id foo name foo input type checkbox id foo bar name foo bar ... You need to..
Creating a div element in jQuery http://stackoverflow.com/questions/867916/creating-a-div-element-in-jquery like #id element or .class then use the .append div foo div function. Alternatively you can use the .html as mentioned..
Javascript get reference to parent object/class from event handler http://stackoverflow.com/questions/10656119/javascript-get-reference-to-parent-object-class-from-event-handler that there is no such thing as a Javascript class called Foo with an event handler that is attached to a click event. When.. handler is called I want to modify a property of my class Foo. Normally I would use the this keyword but in the event handler.. reference to the html element. Here is my code function Foo this.num 0 'element' .click this.eventHandler jQuery to attach..
Using jQuery's getJSON method with an ASP.NET Web Form http://stackoverflow.com/questions/1176603/using-jquerys-getjson-method-with-an-asp-net-web-form public static string GetRegions int areaId return Foo areaId script DOCTYPE html html xmlns http www.w3.org 1999 xhtml..
jQuery draggable table elements http://stackoverflow.com/questions/307882/jquery-draggable-table-elements body div class 'table' div class 'row' div class 'cell' Foo div div class 'cell' Bar div div div class 'row' div class 'cell'.. div class 'cell' Eggs div div div table tr class'row' td Foo td td Bar td tr tr class 'row' td Spam td td Eggs td tr table..
jQuery getJSON() - how to pass request headers? http://stackoverflow.com/questions/3229823/jquery-getjson-how-to-pass-request-headers setHeader xhr xhr.setRequestHeader 'securityCode' 'Foo' xhr.setRequestHeader 'passkey' 'Bar' script head body h1 Some.. requests headers passed in securityCode with a value of Foo passkey with a value of Bar The setHeader function could also..
XMLHttpRequest cannot load an URL with jQuery http://stackoverflow.com/questions/3828982/xmlhttprequest-cannot-load-an-url-with-jquery .FirstName And I'm trying to get this structure FirstName Foo LastName Bar Hello Foo LastName World Do you know why I'm getting.. to get this structure FirstName Foo LastName Bar Hello Foo LastName World Do you know why I'm getting this error jquery..
How do I filter the returned data from jQuery.ajax? http://stackoverflow.com/questions/4245231/how-do-i-filter-the-returned-data-from-jquery-ajax if this is the retrieved page DOCTYPE html html head title Foo title head body div id wrap div id header h1 Foo h1 div div.. title Foo title head body div id wrap div id header h1 Foo h1 div div id body content div div div id tooltip tooltip div..
jQuery post request (not Ajax) http://stackoverflow.com/questions/4583703/jquery-post-request-not-ajax method POST form .form ' new' title 'Hello World' body 'Foo Bar' form action index method POST input type hidden name title.. title value Hello World input type hidden name body value Foo Bar form .form ' info' userIds 1 2 3 4 'GET' form action info.. first 'John' last 'Smith' postIds null receiver first 'Foo' last 'Bar' postIds 1 2 form action profile method POST input..
ASP.NET MVC Ajax Error handling http://stackoverflow.com/questions/4707755/asp-net-mvc-ajax-error-handling with this attribute MyErrorHandler public ActionResult Foo string id if string.IsNullOrEmpty id throw new Exception oh..
How do you remove all the options of a select box and then add one option and select it with jQuery? http://stackoverflow.com/questions/47824/how-do-you-remove-all-the-options-of-a-select-box-and-then-add-one-option-and-se mySelect.options.length 0 mySelect.options 0 new Option Foo only choice Foo mySelect.options 0 .selected true EDIT selected.. 0 mySelect.options 0 new Option Foo only choice Foo mySelect.options 0 .selected true EDIT selected answer was close..
JQM (jQueryMobile) Dynamically added elements not displaying correctly and CSS is not applied http://stackoverflow.com/questions/5249250/jqm-jquerymobile-dynamically-added-elements-not-displaying-correctly-and-css-i selected Please select an option option option value foo Foo option option value bar Bar option select div div div The..
What's the best way to call a modal dialog in ASP.NET MVC using Twitter Bootstrap? http://stackoverflow.com/questions/8093633/whats-the-best-way-to-call-a-modal-dialog-in-asp-net-mvc-using-twitter-bootstra public class MyViewModel public string Foo get set Required ErrorMessage The bar is absolutely required.. modal aria hidden true button h3 id myModalLabel Create Foo Bar h3 div @using Html.BeginForm Create Home FormMethod.Post.. div class modal body div @Html.LabelFor x x.Foo @Html.EditorFor x x.Foo @Html.ValidationMessageFor x x.Foo div..
How can jQuery behave like an object and a function? http://stackoverflow.com/questions/8734115/how-can-jquery-behave-like-an-object-and-a-function methods Tests these do not represent jQuery methods .each Foo Alerts Foo alert defined at .each alert .removeClass 'Blabla'.. these do not represent jQuery methods .each Foo Alerts Foo alert defined at .each alert .removeClass 'Blabla' Alerts Blabla..
jQueryUI: how can I custom-format the Autocomplete plug-in results? http://stackoverflow.com/questions/2435964/jqueryui-how-can-i-custom-format-the-autocomplete-plug-in-results plug in . Is there a way to highlight search character sequence in drop down results For example if I have data foo bar it and I search for foo I get foo bar in drop down. jquery jquery ui autocomplete jquery autocomplete jquery ui autocomplete.. way to highlight search character sequence in drop down results For example if I have data foo bar it and I search for foo I get foo bar in drop down. jquery jquery ui autocomplete jquery autocomplete jquery ui autocomplete share improve this.. search character sequence in drop down results For example if I have data foo bar it and I search for foo I get foo bar in drop down. jquery jquery ui autocomplete jquery autocomplete jquery ui autocomplete share improve this question..
How to get the current URL in javascript? http://stackoverflow.com/questions/406192/how-to-get-the-current-url-in-javascript jQuery. How do I get the path of the current URL and assign it to a variable Example URL http localhost menuname.de foo bar amp number 0 javascript jquery url path share improve this question To get the path you can use var pathname window.location.pathname..
jQuery Ajax POST example with php http://stackoverflow.com/questions/5004233/jquery-ajax-post-example-with-php Ajax POST example with php I am trying to send data from a form to a database. Here is the form I am using form name foo action form.php method POST id foo label for bar A bar label input id bar name bar type text value input type submit value.. to send data from a form to a database. Here is the form I am using form name foo action form.php method POST id foo label for bar A bar label input id bar name bar type text value input type submit value Send form The typical approach would.. jquery ajax post share improve this question Basic usage of .ajax would look something like this HTML form id foo label for bar A bar label input id bar name bar type text value input type submit value Send form JavaScript variable to..
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 elements such as before and after using jQuery For example my stylesheet has a rule stating... .span after content 'foo' How can I change 'foo' to 'bar' using jQuery javascript jquery html css pseudo element share improve this question .. and after using jQuery For example my stylesheet has a rule stating... .span after content 'foo' How can I change 'foo' to 'bar' using jQuery javascript jquery html css pseudo element share improve this question You could also pass the.. also pass the content to the pseudo element with a data attribute and then use jQuery to manipulate that In HTML span foo span In jQuery script 'span' .hover function this .attr 'data content' 'bar' script In CSS span after content attr data..
jQuery Data vs Attr? http://stackoverflow.com/questions/7261619/jquery-data-vs-attr this question If you are passing data to a DOM element from the server you should set the data on the element a id foo data foo bar href # foo a The data can then be accessed using .data in jQuery console.log '#foo' .data 'foo' outputs bar.. If you are passing data to a DOM element from the server you should set the data on the element a id foo data foo bar href # foo a The data can then be accessed using .data in jQuery console.log '#foo' .data 'foo' outputs bar However.. are passing data to a DOM element from the server you should set the data on the element a id foo data foo bar href # foo a The data can then be accessed using .data in jQuery console.log '#foo' .data 'foo' outputs bar However when you store..
Find object by id in array of javascript objects http://stackoverflow.com/questions/7364150/find-object-by-id-in-array-of-javascript-objects object by id in array of javascript objects I've got an array myArray 'id' '73' 'foo' 'bar' 'id' '45' 'foo' 'bar' etc. I'm unable to change the structure of the array. I'm being passed an id of 45 and I want.. object by id in array of javascript objects I've got an array myArray 'id' '73' 'foo' 'bar' 'id' '45' 'foo' 'bar' etc. I'm unable to change the structure of the array. I'm being passed an id of 45 and I want to get 'bar' for that.. the items found. If you know that the object is always there and that it only occurs once you can just use result 0 .foo to get the value. Otherwise you should check the length of the resulting array. Example if result.length 0 not found else..
How to select PrimeFaces UI or JSF components using jQuery? http://stackoverflow.com/questions/7927716/how-to-select-primefaces-ui-or-jsf-components-using-jquery components such as h form h dataTable etc with as default separator character. So for example h form id foo p selectManyCheckbox id bar ... will end up in generated HTML as form id foo name foo input type checkbox id foo bar name.. character. So for example h form id foo p selectManyCheckbox id bar ... will end up in generated HTML as form id foo name foo input type checkbox id foo bar name foo bar ... You need to select elements by exactly that ID instead. The is.. So for example h form id foo p selectManyCheckbox id bar ... will end up in generated HTML as form id foo name foo input type checkbox id foo bar name foo bar ... You need to select elements by exactly that ID instead. The is however a..
Creating a div element in jQuery http://stackoverflow.com/questions/867916/creating-a-div-element-in-jquery this question First select the parent element with something like #id element or .class then use the .append div foo div function. Alternatively you can use the .html as mentioned above. #foo .append div hello world div share improve this..
Javascript get reference to parent object/class from event handler http://stackoverflow.com/questions/10656119/javascript-get-reference-to-parent-object-class-from-event-handler I have a class or function containing object I've heard that there is no such thing as a Javascript class called Foo with an event handler that is attached to a click event. When the event handler is called I want to modify a property of.. handler that is attached to a click event. When the event handler is called I want to modify a property of my class Foo. Normally I would use the this keyword but in the event handler the this reference is set to the reference to the html element... but in the event handler the this reference is set to the reference to the html element. Here is my code function Foo this.num 0 'element' .click this.eventHandler jQuery to attach an onclick event to my element. this.eventHandler function..
Using jQuery's getJSON method with an ASP.NET Web Form http://stackoverflow.com/questions/1176603/using-jquerys-getjson-method-with-an-asp-net-web-form Import Namespace System.Web.Services script runat server WebMethod public static string GetRegions int areaId return Foo areaId script DOCTYPE html html xmlns http www.w3.org 1999 xhtml head runat server title jQuery and page methods title script..
jQuery draggable table elements http://stackoverflow.com/questions/307882/jquery-draggable-table-elements script script document .ready function .row .draggable script body div class 'table' div class 'row' div class 'cell' Foo div div class 'cell' Bar div div div class 'row' div class 'cell' Spam div div class 'cell' Eggs div div div table tr class'row'.. 'cell' Bar div div div class 'row' div class 'cell' Spam div div class 'cell' Eggs div div div table tr class'row' td Foo td td Bar td tr tr class 'row' td Spam td td Eggs td tr table body html I'm was wondering a if there's any specific reason..
jQuery getJSON() - how to pass request headers? http://stackoverflow.com/questions/3229823/jquery-getjson-how-to-pass-request-headers ' error function alert 'boo ' beforeSend setHeader function setHeader xhr xhr.setRequestHeader 'securityCode' 'Foo' xhr.setRequestHeader 'passkey' 'Bar' script head body h1 Some Text h1 body html If you run the code above and watch the.. and watch the traffic in a tool like Fiddler you'll see two requests headers passed in securityCode with a value of Foo passkey with a value of Bar The setHeader function could also be inline in the .ajax options but I wanted to call it out...
XMLHttpRequest cannot load an URL with jQuery http://stackoverflow.com/questions/3828982/xmlhttprequest-cannot-load-an-url-with-jquery success readData data function readData data alert data 0 .FirstName And I'm trying to get this structure FirstName Foo LastName Bar Hello Foo LastName World Do you know why I'm getting this error jquery json cross domain share improve this.. function readData data alert data 0 .FirstName And I'm trying to get this structure FirstName Foo LastName Bar Hello Foo LastName World Do you know why I'm getting this error jquery json cross domain share improve this question You can't..
How do I filter the returned data from jQuery.ajax? http://stackoverflow.com/questions/4245231/how-do-i-filter-the-returned-data-from-jquery-ajax on the structure of your retrieved HTML page. For example if this is the retrieved page DOCTYPE html html head title Foo title head body div id wrap div id header h1 Foo h1 div div id body content div div div id tooltip tooltip div body html.. example if this is the retrieved page DOCTYPE html html head title Foo title head body div id wrap div id header h1 Foo h1 div div id body content div div div id tooltip tooltip div body html If you want to select the top level elements elements..
jQuery post request (not Ajax) http://stackoverflow.com/questions/4583703/jquery-post-request-not-ajax body . Here are some examples .form ' index' form action index method POST form .form ' new' title 'Hello World' body 'Foo Bar' form action index method POST input type hidden name title value Hello World input type hidden name body value Foo.. Bar' form action index method POST input type hidden name title value Hello World input type hidden name body value Foo Bar form .form ' info' userIds 1 2 3 4 'GET' form action info method GET input type hidden name userIds value 1 input type.. type hidden name userIds value 4 form .form ' profile' sender first 'John' last 'Smith' postIds null receiver first 'Foo' last 'Bar' postIds 1 2 form action profile method POST input type hidden name sender first value John input type hidden..
ASP.NET MVC Ajax Error handling http://stackoverflow.com/questions/4707755/asp-net-mvc-ajax-error-handling and then decorate your controller action with this attribute MyErrorHandler public ActionResult Foo string id if string.IsNullOrEmpty id throw new Exception oh no return Json new success true and finally invoke it .getJSON..
How do you remove all the options of a select box and then add one option and select it with jQuery? http://stackoverflow.com/questions/47824/how-do-you-remove-all-the-options-of-a-select-box-and-then-add-one-option-and-se learn jQuery. var mySelect document.getElementById 'mySelect' mySelect.options.length 0 mySelect.options 0 new Option Foo only choice Foo mySelect.options 0 .selected true EDIT selected answer was close to what I needed. This worked for me '#mySelect'.. mySelect document.getElementById 'mySelect' mySelect.options.length 0 mySelect.options 0 new Option Foo only choice Foo mySelect.options 0 .selected true EDIT selected answer was close to what I needed. This worked for me '#mySelect' .children..
JQM (jQueryMobile) Dynamically added elements not displaying correctly and CSS is not applied http://stackoverflow.com/questions/5249250/jqm-jquerymobile-dynamically-added-elements-not-displaying-correctly-and-css-i fieldcontain select name select_options_1 option value selected Please select an option option option value foo Foo option option value bar Bar option select div div div The JS function var counter 2 var onChange function e val ' selected'..
What's the best way to call a modal dialog in ASP.NET MVC using Twitter Bootstrap? http://stackoverflow.com/questions/8093633/whats-the-best-way-to-call-a-modal-dialog-in-asp-net-mvc-using-twitter-bootstra using System.ComponentModel.DataAnnotations namespace MvcApplication1.Models public class MyViewModel public string Foo get set Required ErrorMessage The bar is absolutely required public string Bar get set In the HomeController Add the following.. class modal header button type button class close data dismiss modal aria hidden true button h3 id myModalLabel Create Foo Bar h3 div @using Html.BeginForm Create Home FormMethod.Post new @class modal form @Html.ValidationSummary div class modal.. Create Home FormMethod.Post new @class modal form @Html.ValidationSummary div class modal body div @Html.LabelFor x x.Foo @Html.EditorFor x x.Foo @Html.ValidationMessageFor x x.Foo div div @Html.LabelFor x x.Bar @Html.EditorFor x x.Bar @Html.ValidationMessageFor..
How can jQuery behave like an object and a function? http://stackoverflow.com/questions/8734115/how-can-jquery-behave-like-an-object-and-a-function a b new f .each function a alert a window. Publish public methods Tests these do not represent jQuery methods .each Foo Alerts Foo alert defined at .each alert .removeClass 'Blabla' Alerts Blabla Notes jQuery's root method is defined as follows.. .each function a alert a window. Publish public methods Tests these do not represent jQuery methods .each Foo Alerts Foo alert defined at .each alert .removeClass 'Blabla' Alerts Blabla Notes jQuery's root method is defined as follows only relevants..
Allowing javascript function to accept any number of arguments http://stackoverflow.com/questions/3583044/allowing-javascript-function-to-accept-any-number-of-arguments icisDashBox '.example9' '500' '500' completeFunction function completeFunction var fooClass #colorbox .addClass FOO var barClass #colorbox .addClass BAR var ajaxCnt .ajax type GET url http www.payso.me.uk dataType html success..
How do I pass the this context to a function? http://stackoverflow.com/questions/3630054/how-do-i-pass-the-this-context-to-a-function and .apply methods allow you to set the context for a function. var myfunc function alert this.name var obj_a name FOO var obj_b name BAR Now you can call myfunc.call obj_a Which would alert FOO . The other way around passing obj_b would alert.. function alert this.name var obj_a name FOO var obj_b name BAR Now you can call myfunc.call obj_a Which would alert FOO . The other way around passing obj_b would alert BAR . The difference between .call and .apply is that .call takes a comma..
multi-sub-domain cookies and ajax problems http://stackoverflow.com/questions/4217489/multi-sub-domain-cookies-and-ajax-problems fine by setting my cookie domain to .mydomain.com here is the response header that sets the cookie MYAUTHCOOKIE FOO domain .mydomain.com path HttpOnly This all works fine for normal browser requests. However I need to make an AJAX request..
Get the id of a the item that is clicked http://stackoverflow.com/questions/8159497/get-the-id-of-a-the-item-that-is-clicked the id of a the item that is clicked I have this html code b class edit id foo1 FOO b b class edit id foo2 FOO2 b b class edit id foo3 FOO3 b And I have this code in jQuery 'b.edit' .click function GET THE.. the id of a the item that is clicked I have this html code b class edit id foo1 FOO b b class edit id foo2 FOO2 b b class edit id foo3 FOO3 b And I have this code in jQuery 'b.edit' .click function GET THE ID OF THE b.edit e.g foo1.. that is clicked I have this html code b class edit id foo1 FOO b b class edit id foo2 FOO2 b b class edit id foo3 FOO3 b And I have this code in jQuery 'b.edit' .click function GET THE ID OF THE b.edit e.g foo1 foo2 foo3 '.editP' .focus How..
how to get out of jquery (jeditable) mess http://stackoverflow.com/questions/966539/how-to-get-out-of-jquery-jeditable-mess
|