Reputation: 1
<script>
alert('helllo');
$('button.savebtn').click(function() {
alert('testin');
var Row1 = $(this).closest('tr').find("#mi").text();
alert(Row1);
var Row2 = $(this).closest('tr').find("#mn").text();
var dataString = "Id=" + Row1 + "&Name=" + Row2;
alert(dataString);
});
</script>
I got the the following error from above code, is anyone able give me the reason why the error occurs??
Uncaught SyntaxError: Unexpected token < at Object.InjectedScript._evaluateOn (:875:140) at Object.InjectedScript._evaluateAndWrap (:808:34) at Object.InjectedScript.evaluate (:664:21)
Upvotes: 0
Views: 664
Reputation: 1
Here list of the full html
<!DOCTYPE HTML>
<HTML>
<HEAD>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="test.js"></script>
<TITLE>LIST OF GATE</TITLE></HEAD>
<BODY><H2>Data</H2>
<TABLE BORDER=1>
<TR>
<TH>ID</TH><TH>NAME</TH><TH>ACTION</TH>
<TR>
<TD id = "mi">1</TD>
<TD id = "mn" contenteditable="true">a</TD>
<TD> <button class= savebtn>Save</button> </TD>
</TR>
<TR>
<TD id = "mi">2</TD>
<TD id = "mn" contenteditable="true">b</TD>
<TD> <button class= savebtn>Save</button> </TD>
</TR>
<TR>
<TD id = "mi">3</TD>
<TD id = "mn" contenteditable="true">c</TD>
<TD> <button class= savebtn>Save</button> </TD>
</TR>
</TABLE>
</BODY></HTML>
Upvotes: 0
Reputation: 8333
If you have your JS in a separate file you don't need to add <script>
and </script>
.
Upvotes: 2