Разделы
Теги | RSS © 2008 – 2017
Контакты
email: igor@veselov.sumy.ua
skype: utz0r2
» » spinner

Spinner на jquery


<table class="gCounter"><tr><td><span id="gCounterSpan">1</span></td><td><a href="#" class="counterUp">+</a><br><a href="#" class="counterDown">-</a></td><td>&nbsp;шт.</td></tr></table>

        $('.counterUp').click(function() {
var tmParent = $(this).parent("td").parent('tr');
var count = tmParent.children('td').children('span').html();
count++;
tmParent.children('td').children('span').html(count);
return false;
});

$('.counterDown').click(function() {
var tmParent = $(this).parent("td").parent('tr');
var count = tmParent.children('td').children('span').html();
if (count > 1) {
count--;
}
tmParent.children('td').children('span').html(count);
return false;
});

http://jsfiddle.net/LzNVZ/
Вверх