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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:48:16+00:00 2026-06-04T05:48:16+00:00

Ok I have a Html element like this <input type=button id=harhar/><label for=harhar>Im only for

  • 0

Ok I have a Html element like this

<input type="button" id="harhar"/><label for="harhar">Im only for Id</label>

Is it possible that i can refer a label to a element not using id but a class? like this one

<input type="button" class="harhar"/><label for="harhar">Refer me as a class</label>

is this possible?

NOTE: this is for the sake of creating dynamic Jquery UI buttons in the server-side, that is why I want this to refer a class

  • 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-04T05:48:18+00:00Added an answer on June 4, 2026 at 5:48 am

    No, it is not possible to match a class and a for together. However, there are things that you can do to ensure that your id’s and for’s are uniquely different from other for and id attributes.

    When you generate your elements on the server-side, use a for loop or some other looping construct to enumerate your id/for attributes.

    <input type="button" id="harhar_1"/><label for="harhar_1">Im only for Id</label>
    <input type="button" id="harhar_2"/><label for="harhar_2">Im only for Id</label>
    <input type="button" id="harhar_3"/><label for="harhar_3">Im only for Id</label>
    

    If you can generate your HTML as such, then you’ll be able to match up your labels and values while still using unique ids.

    Additionally, there is nothing preventing you from still applying a common classname to all of your elements so that you can still easily refer to them with CSS or selectors:

    <input class="harhar" type="button" id="harhar_1"/><label for="harhar_1">Im only for Id</label>
    <input class="harhar" type="button" id="harhar_2"/><label for="harhar_2">Im only for Id</label>
    <input class="harhar" type="button" id="harhar_3"/><label for="harhar_3">Im only for Id</label>
    

    This provides you with the hooks that you need to write succinct CSS rules or manipulate the DOM quickly and easily.

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

Sidebar

Related Questions

I have html like this: <html> <input type='button' name='button1' id='button1'> <input type='button' name='button2' id='button2'>
I have a html element (like select box input field) in a table. Now
I have written xml file which contains html tags as element like <component> <input
I have got this button: <input type=button value=Rep id=rep name=rep class=rep style=width:50px onclick=triggerLabel(1);this.disabled=true;addRep(<?php echo
I have several html input elements which all look something like this: <input id=1
Situation: I have a function that dumps input data into an HTML block element,
I have a div element in an HTML document. I would like to extract
I have an html form that I would like to add inputs fields to
I have following HTML with two elements having the same name <input type=hidden name=
I have a javascript object called 'element' of type HTMLInputElement that corresponds to 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.