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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:24:18+00:00 2026-06-13T02:24:18+00:00

No mutter which template engine used for my question. I involved in project where

  • 0

No mutter which template engine used for my question.

I involved in project where find such code in JSP page:

<li class="clazz" attr="XXX">...</li>

and jQuery code which extract value from attr attribute:

$(".clazz").click(function () {
   var v = $(this).attr("attr");
   ...
}

Actually XXX is URL. I change JSP code to:

<li class="clazz"><a href="XXX">...</a></li>

and JS code to:

$(".clazz").click(function () {
   var v = $(this).find("a").attr("href");
   ...
}

Now I reach goal to have valid HTML.

Using fake tags simplify code but produce invalid HTML.

Is there easy way to pass data to JavaScript and preserve code simplicity?

Which technique to use to pass arbitrary string from template engine to JavaScript?

I assume that this data shouldn’t rendered to user and expect that it shouldn’t be based on CSS like by hiding data:

<span id="real-points-count" style="display:none">${param}

UPDATE. How is this code:

<div class="clazz" min="MINDATA" max="MAXDATA">...<>

can be transformed to carry MINDATA and MAXDATA to JavaScript in way to get valid HTML5?

  • 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-13T02:24:19+00:00Added an answer on June 13, 2026 at 2:24 am

    If you can work with HTML5, you can make use of data-* attributes which can let you add custom attributes to store data for an HTML element.

    e.g.

    <li class="clazz" data-myattr="XXX">...</li>
    

    And then in JS’

    $(".clazz").click(function () {
       var v = $(this).data("myattr");
       ...
    }
    

    References: HTML5 Custom Data Attributes (data-), jQuery HTML5 data- Attributes

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

Sidebar

Related Questions

The following code is just used to illustrate my question. template<class T> class array<T>
I have some JavaScript, which is generated by PHP code, using a template. The
In my template-matching code I need the user to pass a floating-point parameter, which
Assume I've declared a function (or class, doesn't matter) in a header file, which
I have a template which allows the user to edit their user information. <form
Is there a way to write an XSL 1.0 template which is matching in
I need to build a web page with a DetailsView which has a bunch
I have a base class called Component which has a number of classes derived
The following code (which compiles and executes properly, doing what I want) is a
I am working on a simple textBox template, which is just two borders, one

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.