안녕하세요, topmenu 요소의 각 항목의 너비를 읽고 항목의 너비를 추가하고 변수에 할당하려고합니다. 이 코드의 문제가 무엇인지 경고 에서 내가 NaN이 무엇입니까이 코드를 실행할 때 :
$(document).ready(function(){
$('.topmenu').each(function(menu){
var btext = $(this).find('.baritem').width();
alert(btext);
var itemswidth = +itemswidth+btext;
alert(itemswidth);
//var width = getTextWidth(btext,"arial","40");
//alert(width);
});
});
유 수 html 코드를 보여주세요 – PSR
'undefined + number = = NaN' ?? – elclanrs