Ravshan Abdurasulov Ravshan Abdurasulov - 7 months ago 16
jQuery Question

Jquery drop down changing value

I am junior in jquery so not be serios. I want to do simple script which adding 1 to the dropdown list value. I tried many of them by this link:
Adding +1 to jQuery value of a readonly text input field
However that is not helped.That is my script.

$('#nextPage').click(function () {
// var page = $('#page').val();
var page = Number($('#dropdown-pages')).dropdown('get val')+1;




<form id="search" method="POST" class="ui small form sixteen wide column segment">

<div class="three wide field">
<label>Page number</label>
<div class="ui selection dropdown" id="dropdown-pages">
<input type="hidden" name="page" id="page" value="{{ filters.page }}">
<div class="default text">Limit</div>
<i class="dropdown icon"></i>
<div class="menu">
{% for page in 1..count_pages %}
<div class="item" data-value="{{ page }}">{{ page }}</div>
{% endfor %}
<div class="two wide field">
<label>By one</label>
{% if filters.page != 1 %}
<button class="ui submit button"><</button>
{% endif %}
{% if filters.page != count_pages %}
<button class="ui submit button" id='nextPage'>></button>
{% endif %}



enter image description here


You can get value of dropdown-pages by:

var page = parseInt($('#dropdown-pages').val())+1;