[Solved] Why can’t I simply prepend text? [closed]


You are removing elements and then targeting them using prepend. You can’t prepend content to no more existing element. Target again the content of the DIV, using end():

DEMO jsFiddle

var ur_text = "your text";
$('.booktext').contents().filter(function(){
     return this.nodeType !== 1;
}).remove().end().prepend('your text');

1

solved Why can’t I simply prepend text? [closed]