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

  • Home
  • SEARCH
  • 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 4006736
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:33:00+00:00 2026-05-20T08:33:00+00:00

Cosmetic question: I have a html element containing possible dimensions for some embedded images,

  • 0

Cosmetic question:
I have a html element containing possible dimensions for some embedded images, these are stored as:

<div class="inside" data-dimensions='{ "s-x": 213, "s-y": 160, "m-x": ...

I get out the data-dimension and parse with jQuery.parseJSON(jQuery.data(“dimensions”)) all fine and closely following the jquery’s doc.

However I’m used to encapsulate all my html attributes inside double quotes:

<div class="inside" data-dimensions="{ 's-x': 213, 's-y': 160, 'm-x': ...

But then I get a malformed json exception. Are there ways so i can obey my self imposed “double quoted html attributes” law?

  • 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-05-20T08:33:01+00:00Added an answer on May 20, 2026 at 8:33 am

    You can use &quot; instead of ". But quoting orgies are horrible (in HTML even more than in PHP) so better go with single-quoting your html attributes.

    BTW, you do not need to use .parseJSON – jQuery does that automatically if the data- attribute starts with { (actually, it’s more complex – here’s the regex it uses to test if it should be parsed as JSON: ^(?:\{.*\}|\[.*\])$).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have more of a cosmetic question: I have a memory stream (void *)
I have a rather annoying cosmetic issue with jQuery. I'm using the $(window).scroll event
In a class called 'Quality' I have the following constants defined: class Quality <
I recently got tossed some C# code to make some minor cosmetic changes to.
I have been asked to make a few cosmetic changes to our production deployment.
This may be a very obvious question - apologies if it is. I have
I have ASP.NET application on hosting provider for some tasks that I can't do
Very recently I asked this question on how to pass clicks through an element
When I receive code I have not seen before to refactor it into some
In my webpage, testing on Chrome, I have a button div. The button is

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.