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 -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -