Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#14590 closed bug (invalid)

Issue in .html()

Reported by: ravindra.alld@… Owned by: ravindra.alld@…
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

Hi,

When I use .html (String) method where string has some java script. After apply .html its fails and give error as

Uncaught SyntaxError: Unexpected token < jquery-1.10.2.js:612 <https://localhost:7004/XYZ/JS/jquery-1.10.2.js>(anonymous function)jquery-1.10.2.js:612

The same piece of code is working fine in jQuery 1.9.1. I debug the issue and got a point that the text which is appended by the .html method has some java script inside it and also has the < sign in a for loop.

Please suggest the appropriate way of solving this issue.

Change History (4)

comment:1 Changed 6 years ago by timmywil

#14591 is a duplicate of this ticket.

comment:2 Changed 6 years ago by timmywil

Owner: set to ravindra.alld@…
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the "jQuery(edge)" version to ensure the issue still exists—you may need to change this to a specific version depending on the test case.

To get you started, use the appropriate boilerplate:

Open the link and click to "Fork" (in the top menu) to begin.

Also, please read:

Additional resources:

comment:3 Changed 6 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:4 Changed 6 years ago by ravindra.alld@…

Hi, Sorry for the late reply. I got solution of my issue. The problem is in the string which we are going to set by .html() method.

In that screen there is a script tag which is pointing to some external JS file and that file is not exist at that location. It is causing the error as

Uncaught SyntaxError: Unexpected token < jquery-1.10.2.js:612

By removing that script tag issue is resolved.

Might be this is an enhancement in jQuery 1.10.2 because same piece of code is working fine in jQuery 1.9.2.

Anyways thanks for the response :)

Note: See TracTickets for help on using tickets.