function Redirect(element) {

  // Default options
  var options = {}

  // Private variables
  var el = $(element);
  var data = '';
  var initialLink;
  var action;

  // base setup
  function init() {
    data = el.data('redirect').split(',');
    var input = el.find('input');
    action = $(data[0]);
    initialLink = action.prop('href');
    input.on('click', function(e) {
      if ($(e.target).is(':checked')) {
        action.prop('href', data[1]);
      }
      else {
        action.prop('href', initialLink);
      }
    });
  }

  /**
   * Expose public methods
   */
  var self = {
    init: init
  }

  return self
}
/**
 * Change link on an id item to redirect it
 */
Change link on an id item to redirect it
Change link on an id item to redirect it
function Redirect(element) {
  var options = {}
  var el = $(element);
  var data = '';
  var initialLink;
  var action;
  function init() {
    data = el.data('redirect').split(',');
    var input = el.find('input');
    action = $(data[0]);
    initialLink = action.prop('href');
    input.on('click', function(e) {
      if ($(e.target).is(':checked')) {
        action.prop('href', data[1]);
      }
      else {
        action.prop('href', initialLink);
      }
    });
  }
  var self = {
    init: init
  }
  return self
}
function Redirect ( element ) { var options = { } var el = $ ( element ) ; var data = '' ; var initialLink ; var action ; function init ( ) { data = el . data ( 'redirect' ) . split ( ',' ) ; var input = el . find ( 'input' ) ; action = $ ( data [ 0 ] ) ; initialLink = action . prop ( 'href' ) ; input . on ( 'click' , function ( e ) { if ( $ ( e . target ) . is ( ':checked' ) ) { action . prop ( 'href' , data [ 1 ] ) ; } else { action . prop ( 'href' , initialLink ) ; } } ) ; } var self = { init : init } return self }
Change link on an id item to redirect it
Change link on an id item to redirect it
// Default options // Private variables // base setup /**
   * Expose public methods
   */