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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:26:31+00:00 2026-05-17T01:26:31+00:00

I am currently jQuerifying (if there is such a word) my website. I am

  • 0

I am currently jQuerifying (if there is such a word) my website. I am not good at JavaScript at all, and not great on jQuery. Object orientation is way passed me in JS, but the rest of my site is object oriented VB.net. I noticed, from some experience I had of jQuery a while back, just how difficult it can be when loading pages for a particular row – you have to somehow find out what ID, for example, to submit and stuff like that.

Just recently I tried using something like:

<li class="catalogueItem"><a pName='" & Product.Name & "' pID='" & Product.ID & "'>" & Product.Name & "</a></li>

Ok so this isnt quite the same – I was adding something like this as a literal control, but I dont have the code on screen at the moment so I just wrote something like it.

Anyway I then tried the following:

$("li.catalogueItem").click(function() {
    $(this).html($(this).find("a").attr("pID"));
});

This should work fine, based on my findings. So my questions are as follows:
a) is there a problem with using this technique?
b) what do other people think of this technique?
c) is it ok to use this technique, in other peoples opinions, despite the fact that the HTML wont comply with W3C etc?
d) can anyone point me in the direction of a more efficient or easier, or perhaps even more difficult / complicated but widely accepted, way to do this kind of thing?

Please bear in mind that a product may have many attributes and I may use it on the admin front end to rearrange products through a drag and drop interface.

Many thanks in advance.

Regards,

Richard

Rather long note to Rubens…

I dont know whether you have ever done any VB.Net before but I cannot find a way to create a server side script tag and then say something like:

ScriptTag.Controls.add(New LiteralControl("$('#" & MyDiv.clientID.toString & "').data('ProductName', '" & Product.Name & "');"))

I have tried and tried and tried but the only ways I can find are to store the scripts at serverside (maybe in an array) and then override the page render event (by which time all the scripts will have been added to the array) to output these in one script tag or, slightly more horrific, make the head tag run at the server and then add a script tag everytime I need to output another piece of script. Either way implementing these techniques would result in either taking a very long time to implement such a method or a ghastly long head tag with many script tags.

I for one believe developers should keep to the guidelines wherever possible – so I keep script tags in the head where they belong.

The way I suggested can be done “on the fly” – and the scripts will be loaded whether or not they are needed (they are specified in the head tag in the masterpage).

The way I see it the way I suggested has a lot more advantages as it is a lot easier to code (in my experience) and can be coded quicker.

One thing which did just occur to me… there is something called a ScriptManager which I have seen in Visual Studio… I wonder if that has anything to do with keeping scripts in one place… maybe its time to do some investigating… Will post back here if I think of anything else, or learn anything else about either method (pros and cons and alike).

Richard

  • 1 1 Answer
  • 1 View
  • 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-17T01:26:32+00:00Added an answer on May 17, 2026 at 1:26 am

    If you’re going to use custom attributes, I’d say use data- attributes, like this:

    <li class="catalogueItem"><a data-pName='" & Product.Name & "' data-pID='" & Product.ID & "'>" & Product.Name & "</a></li>
    

    In HTML5 data- prefixed attributes are for exactly this purpose…but won’t cause any issues on an HTML4 document (though they are technically invalid). For now you access them like this:

    $("li.catalogueItem").click(function() {
      $(this).html($(this).find("a").attr("data-pID"));
    });
    

    In the upcoming jQuery 1.5, .data() will look for them as a fallback as well, like this:

    $("li.catalogueItem").click(function() {
      $(this).html($(this).find("a").data("pID"));
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, db4o does not allow indexing on the contents of collections. What object databases
Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and
Currently we use jQuery to add RIA goodness to our apps, but recently we
Currently I am adding object by creating it like: type TRecord = class private
Currently I have to deal with the legacy system written in VB. I'm not
Currently local storage for javascript is limited to cookies, which makes robust client side
Currently in my webpage i load images to the ListView object as follows... <ContentTemplate>
Currently, when my server goes to store a character's information, it'll delete all records
Currently i m working on a project where there are users with four roles
Currently, I know there are several official Android styles. @android:style/Theme.Black @android:style/Theme.Light @android:style/Theme.Translucent But I

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.