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

The Archive Base Latest Questions

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

In my code I am pulling a data-attribute called grid size from the HTML.

  • 0

In my code I am pulling a data-attribute called grid size from the HTML. When grid size is pulled through I want to write a statement that says if the value is “large” then the x and y co-orginates are… and if the value is “small” then the x and y co-ordinates are… I have given it a go but I can’t get it working. Can someone show me where I am going wrong?

Here is the statement that pulls it from the HTML

    $('li[data-number-input],li[data-completion-number]').each(function(){
    numberInput.push($(this).attr('data-number-input'));
    completionNumber.push($(this).attr('data-completion-number'));
    gridSize.push($(this).attr('data-grid-size'));
});

Here is the statement I have written

if ($(this).data('grid-size') == "large") {
    gridColumns = 4;
    gridRows = 4;
}
else {
   gridColumns = 6;
   gridRows = 8;
}

Here is the html

<li data-number-input="6" data-completion-number="1" data-grid-rows="8" data-grid-columns="6" data-grid-size="large"></li>  
  • 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-13T22:47:39+00:00Added an answer on June 13, 2026 at 10:47 pm

    There is a syntax error in your code, you have missed a ) for the push method and I’m not sure why you are using push method in an if statement, you can use data method:

    if ($(this).data('grid-size') === "large") {
       // ...
    } else {
       // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My code is pulling from a data cells that lists multiple file paths and
My jqGrid that does a great job of pulling data from my database, but
I am pulling data from a database that uses the ASCII character 254 as
I'm using Entity Framework code first and pulling some data back from our database.
I am pulling data from an XML feed via C# code. When I get
I'm pulling data from Dynamics AX 2009 from c# using the following code snippet.
Im pulling data from a MySql data table. I'm pulling from a row called
I have a form that pulls data from a database. Code works fine if
I am pulling data from a sql server and putting it into a grid
I have this itemtemplate for a gridview column that is pulling data from a

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.