jquery - appendTo is not a function -


i ran javascript code in browser using jquery, , gave error in title

var tr = {};var obj ={};  obj['amount']=$('#amount').val();    tr['amount'] = obj['amount']; obj['qty']=$('#qty').val();      tr['qty'] = obj['qty'];  var row = $('<tr></tr>');  $.each(tr, function (type, value) {   $('<td class="input-' + type + ' text-center"></td>').html(value).appendto(row); }); 

can 1 point out i'm doing wrong?

tr should array, not object.
more here: http://api.jquery.com/jquery.each/

bad, $.each works objects.

the value of #amount should either json or string you'll convert later array (or object). think step you're missing - converting value works $.each.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -