var arr = [1,2,3,4,5,6,7,8,9],
count = arr.length,
str = '';
for (var i = 0; i < count; i++) {
str += '' + arr[i];
if ((i+1) % 2 === 0 || (i+1) === count) {
$('#block').append('<div>' + str + '</div>');
str = '';
}
}
<select>
<option value="7827 руб">80x190/200см</option>
<option value="8768 руб">90x190/200см</option>
<option value="11271 руб">120x190/200см</option>
</select>
<p>Цена матраса: <span id="price"></span></p>
$('select').on('change', function(e) {
$('#price').text($(this).val());
});
$.ajax({
url: '/wp-content/themes/theme/include/profile/forms-handler.php',
type: 'POST',
dataType: 'json',
data: {
'user_id': user_id,
'post_id': post_id,
'type_vote': type_vote,
'action': 'vote'
},
})
.done(function(data) {
if(data.result == 'success'){
var count = parseInt(element.find('b').html());
element.find('b').html(count+1);
} else {
alert('Вы уже проголосовали');
}
});
$('select').val(price);
$('select').val(price).change();
$('.custom_block').each(function() {
if ($(this).find('.price-unknown').length) {
$(this).find('.block_payment_custom').hide();
}
});
$('.ya_donate').on('submit', function(e) {
e.preventDefault();
var form = $(this);
var data = form.serialize();
$.post('/site/donate', data, function(data) {
form.unbind('submit').submit();
})
});
<ul class='active'>
$(document).ready(function() {
$("#menu ul").not('.active').hide();
$("#menu li span").click(function() { $(this).next().slideToggle("normal"); });
});