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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:01:23+00:00 2026-05-27T16:01:23+00:00

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

  • 0

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  $comment_id; ?>);"/>

<script type="text/javascript">

     function triggerLabel($commentID)
     {
        var $theID="#"+$commentID;
        var $label=document.getElementById($theID).value;
        alert($label);
     }

</script>

The alert isn’t triggered. I want to obtain the commentID and convert it to a string.. And I want that string to represent my element ID. The alert works, it retrieves #25. That’s the id that I gave one of my labels..

echo '<label id="'.$comment_id.'">'.$avatarRep.'</label>';

It should retrieve that label, but unfortunately it fails..I get this:

Error: document.getElementById($theID) is null
Source File: http://localhost/PoliticalForum/Thread/thread.php?threadID=15&page=1
Line: 246

What do I do?

That’s how the label html control looks like when I view the source page:

<label id="25">6</label>

UPDATE:
I updated my answer. Take a look:

var $label=document.getElementById($commentID);
$label.value=9999;

The 9999 isnt inserted into the table..why?!?

UPDATE 2:
This doesnt work:

document.getElementById($commentID).value="88888";

The label isnt changed.

  • 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-27T16:01:23+00:00Added an answer on May 27, 2026 at 4:01 pm

    Either use getElementById properly, i.e. remove the #:

    var $label = document.getElementById($commentID);
    

    or use jQuery:

    var $label = $($theID);
    

    Note that labels don’t have a value property. If you want to get the inner text, use innerHTML or .text() with jQuery.

    Also, before HTML5, IDs where not allowed to start with digits.

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

Sidebar

Related Questions

I got this div... <div tabindex=0 class=button-base inline-block button aw-btn button-base-active> <input type=text tabindex=-1
I have this: <input type=password id=txtPassword name=txtPassword /> and I want to do something
I have got [hide] and [unhide] input buttons , the hide button shows some
Im writing a class that replaces all input type=button and input type=submit in the
I have got jquery post function jQuery('.more-button').live('click', function(eve){ var page = jQuery(this).attr('id').replace('more-button-',''); loaded_messages +=
I have got this error when using Enterprise Library 3.1 May 2007 version. We
I have got this code: XDocument xdoc = XDocument.Load(URI); XElement root = xdoc.Element(forecast); //get
I have got this code and I am trying to understand the convention followed,
I have got an XML document which looks something like this. <Root> <Info>....</Info> <Info>....</Info>
I have got some javascript code and I'd like to convert this to C#.

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.