JSFiddle - React, Tailwind, and code Playground

by s4ty

HTML

<form id="form1" name="form1" method="post" action="">
  <input type="radio" id="radio-1-1" name="radio-1-set" class="black-radio" value="0" checked="checked" />
  <label for="radio-1-1"></label>
  <input type="radio" id="radio-1-2" name="radio-1-set" class="white-radio" value="1" />
  <label for="radio-1-2"></label>
</form>

<div class="iphone4s_black"><img src="http://s4ty-testarea.s4.ohost.de/jQuery-board/images/001.jpg"/></div>

JavaScript

$(function() {
    var speed = 350,
        img = [
        'http://s4ty-testarea.s4.ohost.de/jQuery-board/images/001.jpg',
        'http://s4ty-testarea.s4.ohost.de/jQuery-board/images/004.jpg'
    ];   
        
  $("#radio-1-1, #radio-1-2").click(function() {
      var num = $(this).val();
      $(".iphone4s_black img").fadeOut(speed, function () {
          $(this).attr({src: img[num]}).fadeIn(speed);
      })
  });
});