Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

need t know about check box list in javascript ?

how to add check box list item using javascript at runtime?

3 Answers

Relevance
  • ?
    Lv 4
    1 decade ago
    Favorite Answer

    //pk

    <html>

    <head>

    <title>Test</title>

    <script type="text/javascript">

    function addItem() {

    var currentElement = document.createElement ("input");

    currentElement.setAttribute ("type","checkbox");

    currentElement.setAttribute ("text","checkbox");

    oData.appendChild (currentElement);

    }

    </script>

    </head>

    <body>

    <SPAN ID="oData" ></SPAN>

    <input type="button" value="Create" onclick="addItem()">

    </body>

    </html>

  • 1 decade ago

    <head>

    <script type="text/javascript">

    function addItem() {

    var checkbox = document.createElement ("input");

    checkbox.type = "checkbox";

    checkbox.name = "myCheckbox";

    // to check it by default

    // checkbox.checked = true;

    var insertInto = document.getElementById ("insertInto");

    insertInto.appendChild (checkbox);

    }

    </script>

    </head>

    <body>

    <input type="button" value="Create" onclick="addItem()">

    <div id="insertInto"></div>

    </body>

  • 1 decade ago

    what do you mean?

Still have questions? Get your answers by asking now.