javascript - uncaught syntaxerror unexpected token in Chrome in jquery replaceWith -


this question has answer here:

jquery('div#top').replacewith('<div id="top">  </div>') 

chrome says uncaught syntaxerror unexpected token in first line. dont know whats error here. trying replace top div.

fyi -- replacing whole data of div top mine. placing lot of div`s inside top havent pasted here.

javascript strings can't span across multiple lines. either have add newline escape sequences:

jquery('div#top').replacewith('<div id="top">\n\n</div>') 

or add backslashes @ end of each line:

jquery('div#top').replacewith('<div id="top">\ \ </div>') 

or use .html() (assuming weren't trying rid of attributes on element):

jquery('div#top').html('') 

or .empty():

jquery('div#top').empty() 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -