by matt | May 25, 2016 | Javascript / Jquery
Here is a simple example and explanation of finding and replacing a html element using jquery syntax: $(selector).replaceWith(content,function(index)) simple example: $(“div.replacehere”).replaceWith(“<H1>The new content</H1>”);...
by matt | Dec 15, 2014 | Javascript / Jquery, Uncategorized
$(“#menu-item-999 > a”).attr(“href”, “http://www.newaddres.com”);
by matt | Oct 1, 2014 | Javascript / Jquery, Uncategorized
// check if element exists if($(‘selector’).length){ //do something } // check if element does not exist if(!$(‘selector’).length){ //do something }
by matt | Sep 26, 2014 | Javascript / Jquery, Uncategorized
HTML: <ul id=”Items-container”> <li>1111</li> <li>2222</li> <li>3333</li> <li>4444</li> <li>5555</li> </ul> jQuery snippet: var swapElements = function(siblings,...
by matt | Sep 26, 2014 | Javascript / Jquery, Uncategorized
In order to move the last element of the first position within the container we can use prepend jQuery command. Please see the following examples : <ul class=”list-container”> <li>first item will go to the end</li> <li>second...
by matt | Sep 25, 2014 | Javascript / Jquery, Uncategorized
Wrap your jquery code with the following: if (!sessionStorage.alreadyShown) { …. yourFunctionOrCodeHere(); …. sessionStorage.alreadyShown = “true”; }