Sha256: 3f721024501f09f0d81a9897f2bb26c9450aab6b583019be606097ac091815a0

Contents?: true

Size: 408 Bytes

Versions: 131

Compression:

Stored size: 408 Bytes

Contents

Spree.ready(function() {
  // Highlight negative numbers in red.
  document.querySelector('body').addEventListener('input', function(e){
    var el = e.target;
    var isInputNumber = el instanceof HTMLInputElement && el.type == 'number';
    if (isInputNumber) {
      if (el.value < 0) {
        el.classList.add("negative");
      } else {
        el.classList.remove("negative");
      }
    }
  });
});

Version data entries

131 entries across 131 versions & 2 rubygems

Version Path
solidus_backend-4.4.1 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.4.0 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.3.4 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.2.4 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.1.5 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.3.3 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.3.2 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.1.4 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.3.1 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.3.0 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.2.3 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.1.3 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.0.4 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-3.4.6 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.0.3 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.1.2 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.2.2 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-3.4.5 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.2.1 app/assets/javascripts/spree/backend/highlight_negative_numbers.js
solidus_backend-4.2.0 app/assets/javascripts/spree/backend/highlight_negative_numbers.js