F
F
Frank_Sidebottom2018-03-25 01:01:07
JavaScript
Frank_Sidebottom, 2018-03-25 01:01:07

Conditional construction and value?

Hi. The conditional construct is not working. What is wrong here? Why is the alert not working? It seems that I wrote everything correctly, I don’t understand what’s the matter.

https://jsfiddle.net/s99Lxdw8/3/

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya33, 2018-03-25
@Frank_Sidebottom

the button selector is a tag, not a class, and div doesn't have a val() method - input has one
https://jsfiddle.net/L90w5c8o/

K
KazeZlat, 2018-03-25
@KazeZlat

1. The handler will not be hung on your button, because the button doesn't have the class you specified in the JS. Remove the dot, or add a class to the button.
2. div cannot have a value, use the data attribute instead: or replace div with<div class="time-wrap" data-value="25"></div>$('.time-wrap').data('value') == 25<input type="hidden" value="25">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question