Reputation: 547
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();
$('#page').val(page + 1);
$('#search').submit();
});
<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>
</div>
</div>
<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 %}
</div>
Search
Clear
Upvotes: 0
Views: 48
Reputation: 547
var page = parseInt($('#page').val());
$('#page').val(page + 1);
$('#search').submit();
Upvotes: 0
Reputation: 5039
You can get value of dropdown-pages by:
var page = parseInt($('#dropdown-pages').val())+1;
alert(page);
Upvotes: 1