开发者

jQuery: A problem with .each function

I send t开发者_开发技巧o the javascript an array like:

jQuery: A problem with .each function

 $.each(data, function (value, name) {
    $('#visitStart').append($('<option></option>').val(value).html(value));
 });

and as a result I see that the visitStart input is filled by values from 0 to 241. Why ?


$.each sends an index, and value into the callback function - http://api.jquery.com/jQuery.each/

 $.each(data, function (i, obj) {
    $('#visitStart').append($('<option></option>').val(obj.value).html(obj.value));
 });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜