Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8698765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:47:46+00:00 2026-06-13T01:47:46+00:00

When I place the following jQuery code in JSP: <script> $(document).bind(ready,function(){ var recordPerPages=3; var

  • 0

When I place the following jQuery code in JSP:

<script>
    $(document).bind("ready",function(){
        var recordPerPages=3;
        var currentPage=1;
        var trs=$("table tr");
        alert(trs);

        function create(pageNo){
            $("table").empty();
            var endRec=pageNo*recordPerPages;
            var stRec=endRec-recordPerPages;
            trs.each(function(indx){
                if((indx+1)>=stRec && indx<endRec){
                    $("table").append($(this))
                }
            })
        }
        create(currentPage)

        $("#prev").bind("click",function(){
            currentPage=currentPage-1
            create(currentPage)
        })

        $("#next").bind("click",function(){
            currentPage=currentPage+1
            create(currentPage)
        })
    })
</script>

Then I get the following error:

editListContributions.jsp:38:29: Illegal token.
       if((indx+1)>= stRec && indx <  endRec){

                        ^

How is this caused and how can I solve it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:47:47+00:00Added an answer on June 13, 2026 at 1:47 am

    That can happen if you’re actually using JSPX instead of JSP. JSPX is XML based. All special characters in XML such as <, & and > (which represent respectively the start of a XML element, the start of a XML entity and the end of a XML element) needs to be escaped as &lt;, &amp; and &gt;.

    if((indx+1)&gt;= stRec &amp;&amp; indx &lt; endRec){
    

    An alternative to this unreadable mess is to put the entire script in a CDATA block.

    <script>
        <![CDATA[
            ...
        ]]>
    </script>
    

    Much better is however to put JS code in its own .js file which you include by <script src>.

    <script src="onload.js"></script>
    

    See also:

    • Mozilla Developer Network – Writing JavaScript for XHTML
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jquery code: $(document).ready(function() { $(#build_table, a.coursename, .Start Date, .Book Title,
In the following jQuery code: $(document).ready(function(){ function parse(document){ $(document).find(entry).each(function(){ $(#items).append( '<h3><a href=#>'+$(this).find('title').text()+'</a></h3>'+ '<div> '+$(this).find('summary').text()+'</div>'
The following snippet of jquery says wait until the document is ready. $(document).ready(function() {
I have the following jQuery code in place on my page: var isChanged =
Consider the following html snippet <!DOCTYPE html> <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.4.2.js ></script> <script
I have the following code..... <head> <script src=Scripts/jquery-1.7.2.min.js type=text/javascript></script> <script src=Scripts/hidepanel.js type=text/javascript></script> </head> <body>
Im using the following code to place an object inside a container: testParent =
The following is a function that post the values and updation takes place in
So, I'm finishing up an iPhone App. I have the following code in place
I'm using the following code in a rails partial to place a call to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.