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 8266723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:15:46+00:00 2026-06-08T05:15:46+00:00

(function (){ var num = parseInt($(‘body’).attr(‘data-site’)) + 1, theul = $(.submenu li:nth-child( + num

  • 0
(function (){

    var num = parseInt($('body').attr('data-site')) + 1,
        theul = $(".submenu li:nth-child(" + num + ") a"),
        newNum = num - 1,
        theNewUl = $(".submenu li:nth-child(" + newNum + ") a");

        console.log(theul);
        theul.addClass('activex');
        console.log(theNewUl);
        theNewUl.addClass('lastsl');

})();

Hello, when I try to run this script console says:

“Uncaught Syntax error, unrecognized expression: li:nth-child”

Althoung I linked the jQuery source before this script,

thanks for anwsers

  • 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-08T05:15:48+00:00Added an answer on June 8, 2026 at 5:15 am
    1. You can use .data("foo") in favor of .attr("data-foo").
    2. You can use the :eq() selector. It’s zero-based, which is what you seem to want.
    3. You do not need to call .addClass() on a separate line.
    4. You must use the radix 10 when you use parseInt(), or numbers like 08 will be interpreted as octal.
    5. You need to make sure that num actually contains a number, or parseInt() will return NaN and that will break your following code.
    6. Prefix variables that contain a jQuery object with a $. It’s a useful convention to follow.

    Try:

    var num = parseInt($('body').data("site"), 10),
        $theul = $(".submenu li:eq(" + num + ") a").addClass('activex'),
        $theNewUl = $(".submenu li:eq(" + (num-1) + ") a").addClass('lastsl');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the JQuery code: $(document).ready(function() { $('.LikeArea').click(function() { var num = parseInt(this.html()); num++;
My js script jQuery(.unblock).click(function(){ var num = jQuery('.page.active').text(); var ban_id = jQuery(this).attr('id'); jQuery.get(http://127.0.0.1/auth_system_1/user_activity/delete_user_ban, {
I have JS : jQuery('.unblock').click(function(){ var num = jQuery('.page.active').text(); var ban_id = jQuery('.unblock').attr('id'); jQuery.post('http://127.0.0.1/auth_system_1/user_activity/delete_user_ban',
Look at this: $('form).submit(function (event) { $(':input.required').trigger('blur'); var num = $('.warning', this).length; alert(num);//Focus here!
I got this code: function zeroPad(num, places) { var zero = places - num.toString().length
for(var i=1; i<496; i++) { (function(num) { myApp.getTerm(num, function (term, def){ myApp.quizlet[0].terms[num] = {
$(function(){ $('.page').click(function() { var paging = $(this).attr(name); var dataString = 'page='+paging; $.ajax({ type: POST,
$(a.close).click(function() { var id = $(this).attr(id); alert(id); $(this).parents(div.venue:first).fadeOut(Fast); return false; }); Any ideas why
We are using following fields to do some calculation. $(document).ready(function(){ $('.num').blur(function () { var
$(function() { var number = document.getElementById(breuken); var i=0; for (i=1;i<=10;i++){ var fRandom = Math.floor(Math.random()*10);

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.