خرید بک لینک

Vote count: 0

I have a unordered list of divs with different data-score values. What I am trying to access the first div with data-score just above the value of the searched value. I have the following code, but it does not seem to work. Any suggestions?

var userscore = $("#userScore").val();

var next = $("div[data-score >=" + userscore + "]").text();

$("#result").text(next);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<input type="hidden" id="userScore" value="20">
<div data-score="5" class="item">A</div>
<div data-score="15" class="item">B</div>
<div data-score="45" class="item">E</div>
<div data-score="25" class="item">C</div>
<div data-score="35" class="item">D</div>


<div id="result">NEXT IS UNKNOWN!</div>
asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 13 ارديبهشت 1395 ساعت: 0:18

صفحه بندی