Tags
jQuery
Asked 7 years ago
9 Aug 2016
Views 1321
jagdish

jagdish posted

.html().appendTo(" in jQuery gives error TypeError: $(...).html(...).appendTo is not a function why ?

I have situation like below ::

i had made a var where i put some template like below


var htm='<div class="portlet">div class="portlet-header">##header##</div></div>';



so later i can change its header and append to particular div based on the ajax response.

like below

 $(htm.replace("##header##",item)).html().appendTo("#SOME_ID");



but this giving me TypeError: $(...).html(...).appendTo is not a function



dilip

dilip
answered Nov 30 '-1 00:00

.html().appendTo will not work . you can remove the .html() function try like this


 $(htm.replace("##header##",item)).appendTo("#SOME_ID");

but appending non html , like its appending string as it is . - jagdish  
Aug 10 '16 18:23
Post Answer