Skip to main content

Bug Tracker

Side navigation

#14590 closed bug (invalid)

Opened November 29, 2013 07:31AM UTC

Closed December 17, 2013 08:39AM UTC

Last modified January 03, 2014 05:02AM UTC

Issue in .html()

Reported by: ravindra.alld@gmail.com Owned by: ravindra.alld@gmail.com
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.

Attachments (0)
Change History (4)

Changed December 02, 2013 03:49PM UTC by timmywil comment:1

#14591 is a duplicate of this ticket.

Changed December 02, 2013 03:50PM UTC by timmywil comment:2

owner: → ravindra.alld@gmail.com
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:

Changed December 17, 2013 08:39AM UTC by trac-o-bot comment:3

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!

Changed January 03, 2014 05:02AM UTC by ravindra.alld@gmail.com comment:4

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 :)