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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:05:11+00:00 2026-05-25T00:05:11+00:00

This is my check-box and it’s created dynamically by getting the value of the

  • 0

This is my check-box and it’s created dynamically by getting the value of the XUL tree.

var yyahoo = tree.view.getCellText(i, tree.columns.getNamedColumn("yahoo")); 

  var existing  = document.getElementById('box');
  var checkbox   = document.createElement('checkbox');
  capt.appendChild(checkbox);
  checkbox.setAttribute('label', yyahoo);
  checkbox.setAttribute("checked", "false")
  checkbox.setAttribute('style', 'color: green;');

Like this I have dynamically created many check-boxes in my XUL file.

When I checked Mozilla website, it is explained that, i have to use hasAttribute() to get the value of the selected check-box, which is confusing to me.

Please help me to get the value of the selected check-box.

This is the button to get the values on-click.

<row><button label="get" oncommand="get();"/></row> 

This is function: This function is not working ’cause something is missing in my function.

function get()
{
// check that the attribute exists before setting a value
var d = document.getElementById("box");
if (d.hasAttribute("checkbox")) {
 alert(d);
}

} 

Thanks for your support.

  • 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-25T00:05:11+00:00Added an answer on May 25, 2026 at 12:05 am

    The checkbox is a child of the element with ID box, not an attribute. Try something like this:

    function get() {
        // check that the attribute exists before setting a value
        var table = document.getElementById("box"); 
        var cells = table.getElementsByTagName("checkbox"); 
        for (var i = 0; i < cells.length; i++) { 
            var cell = cells[i];
            if(cell.checked) {
                alert(cell.getAttribute("label"));
                // or cell.label
            }
         }
    }
    

    The checked property tells you whether the checkbox is currently selected or not. hasAttribute('checked') tells you whether the attribute was set or not. Maybe you have to use both, I don’t know.

    Apparently, the checkbox [MDN] element has no attribute value, so I don’t know which value you are talking about.

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

Sidebar

Related Questions

I have created one listview, in this each row contain check box and the
I am having check box in the column header. The function of this is
I found this post that shows how to pass multiple check box selections to
i want to develop dropdown inside a check box . this url shows me
I have a table where each rows has a check box. This code works
http://img175.imageshack.us/img175/4295/tableissue.png http://img175.imageshack.us/img175/4295/tableissue.png Here's the picture to begin with. I have this check box, that
This simple code checks if there is at lease one check box marked, When
I rendered a check box node tree. The renderer renders the parent nodes with
So I have a check box that fires a command using WPF/MVVM this works
Several answers to questions about check box binding, for example this one suggest that

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.