0
나는 기능JQuery와 반환 값
$.fn.find_place_for_dealer = function() {
$(this).each(function (i, el) {
var number = $(this).parent('.link-wrapper').prevAll('div.link-wrapper').length;
var pos = ((parseInt(number/3) + 1) * 3) - 1;
return pos;
});
return $(this);
};
$('.dealers a').click(function(e){
e.preventDefault();
var pos = $(this).find_place_for_dealer();
var el = '<div class="row"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><div class="dealer-full-info"></div></div></div>';
$('div.link-wrapper').eq(pos).after(el);
});
에서 값을 얻으려고하지만 난 아무것도 얻을 수 없다. 내 코드에 어떤 문제가 있으며 어떻게 수정할 수 있습니까? 요소를 pos
을 얻기 위해 다음
$.fn.find_place_for_dealer = function() {
return this.each(function (i, el) {
var number = $(this).parent('.link-wrapper').prevAll('div.link-wrapper').length;
var pos = ((parseInt(number/3) + 1) * 3) - 1;
$(this).data('pos', pos);
});
};
을 그리고 :
http://jsfiddle.net/EUcu4/4/
jsfiddle 더 나은 것! –
질문을 –
@ Pavlo 업데이트했습니다. 내 HTML 코드를 전혀 볼 수 없었던 것 같습니다. –