D
D
Denis Kuzmin2021-06-07 08:42:35
JavaScript
Denis Kuzmin, 2021-06-07 08:42:35

How to divide a variable by 2 numbers and check if the first one is greater than or earlier than 130?

How can I make it in JQuery so that when a .box is clicked, it checks that the "data-number" of the clicked .box has the first number (before "x") > or = 130 and displays the corresponding result in alert?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Kuzmin, 2021-06-07
@DenKuzmin

$('.box').on('click', function () {
  var num = $(this).data('number');
  var temp = num.split("x");
  var one = temp[0];
  var two = temp[1];
  if (one >= 130) {
    alert('ok!')
  }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question