Sha256: 7458175cdadaf915eef32abae56c086c8a9bdc53450e91847f1b86cbe0f058b4
Contents?: true
Size: 740 Bytes
Versions: 28
Compression:
Stored size: 740 Bytes
Contents
/* Simple plugin to select form elements when other elements are clicked. */ (function($) { $.fn.selectRelatedInput = function() { var clickElements = this; $(clickElements).each(function() { var target = $($(this).data('input-select-target')); var event; if ($(this).is("select")) { event = 'change'; } else { event = 'click'; } $(this).on(event, function() { if (target.is(":checkbox") || target.is(":radio")) { target.prop('checked', true); } else { target.focus(); } }); }); return this; }; })(jQuery); export default class { connect() { $('[data-input-select-target]').selectRelatedInput(); } }
Version data entries
28 entries across 28 versions & 1 rubygems