I have the following JavaScript variable I am using in conjunction with Google Maps API.
For some reason I am getting the error
"Uncaught SyntaxError: Unexpected identifier"
I believe it has to do with the 4th line in the following code snip. I do not expect this abut it seems like there is a common syntax issue with the below?
var EditForm = '<p><div class="marker-edit">'+
'<form method="POST" name="SaveMarker" id="SaveMarker">'+
'<label for="pType"><span>Product:</span>'+'<input type="text" id="userInput" onkeyup="iwproductFilter()" placeholder="Search for names..">'+' '+
'<a onclick="document.getElementById('userInput').value = ''; iwproductFilter();" style="font-size:16px;cursor:pointer;"</a>'+'✖'+
'<ul id="myUL">'+'<li id="1a"><a>Adele</a></li>'+'<li id="1b"><a>Agnes</a></li>'+'<li id="1c"><a>Billy</a></li>'+
'<li id="1d"><a>Bob</a></li>'+'<li id="1e"><a>Calvin</a></li>'+'<li id="1f"><a>Christina</a></li>'+'<li id="1g"><a>Cindy</a></li>'+'<li id="1h"><a>Doug</a></li></ul>'+
'<select name="pType" class="save-type"><option value="restaurant">Rastaurant</option><option value="bar">Bar</option>'+
'<option value="house">House</option></select></label>'+
'<label for="pUserName"><span>Place Name :</span><input type="text" name="pUserName" class="save-name" placeholder="Enter Title" maxlength="40" /></label>'+
'<label for="pDesc"><span>Description :</span><textarea name="pDesc" class="save-desc" placeholder="Enter Address" maxlength="150"></textarea></label>'+
'</form>'+
'</div></p><button name="save-marker" class="save-marker">Add Product</button>';
Your quotes '
in document.getElementById('userInput').value = ''
aren't escaped.
Change it to document.getElementById(\'userInput\').value = \'\'
and it'll work
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments