@public #get #parmeter #url #javascript #js #jquery

how to grab URL GET parameters with Javascript

<div class="content">
  <p>Lorem Ipsum Anything</p>
  <script type="text/javascript">
    if(window.location.href.match(/arg=testA/)){
      document.write('<button name="button">Click me</button>');
    }elseif(window.location.href.match(/arg=TestB/)){
      document.write('<button name="button">Click me now!</button>');
    }else{
      document.write('<button name="button">Show me</button>');
    }
    /* Wobei in der match() Anweisung 
    ** ein beliebiges RegEx enthalten 
    ** sein kann.
    */
  </script>
  <p>Lorem Ipsum Anything</p>
</div>

@public #js #javascript #hover #image #jquery

This is how to change an Image src on Mouse hover with jQuery

HTML

<img src="url1.jpg" data-alt-src="url-2.jpg" class="hover_images"/>
...
<img src="url3.jpg" data-alt-src="url-4.jpg" class="hover_images"/>
...
<img src="url5.jpg" data-alt-src="url-6.jpg" class="hover_images"/>

Javascript

$('.hover_images').hover(function(){
    var $this = $(this);
    var newSource = $this.data('alt-src');
    $this.data('alt-src', $this.attr('src'));
    $this.attr('src', newSource);
});
/** Big Thank to http://stackoverflow.com/a/17507894 **/

Here is a demo

@public #jquery #javascript #js #next #children

How to find next() button is not disabled, if those are not on the same level

HTML

<div><input rel="first" type="radio" name="x" value="1"></div>
 …
<div><input type="radio" name="x" value="2" disabled></div>
 …
<div><input type="radio" name="x" value="3" disabled></div>
 …
<div><input type="radio" name="x" value="4"></div>

Javascript

$('input[rel="first"]').parent().nextAll('label').children('input').not(':disabled')

/** Big Thanks to http://stackoverflow.com/a/24675347/2099411 **/

Projects

Tags

Capsule Servers

Lost connection to server.