SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Born to Code rainadaman's Avatar
    Join Date
    Feb 2005
    Location
    india
    Posts
    793
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question weird problem: creating checkbox at runtime...

    hey guys,
    I have to create checkbox using javascript at runtime...
    the number of checkboxes that is to be created are coming from database .
    I am using AJAX..
    but when I am creating checkbox it is creating textbox.
    I have mentioned chk.type="checkbox"

    here is the code that I am using to create checkbox:

    Code:
    var TagTDa = document.getElementById(TagTD);                
            for (var count = 0; count < tableNodes.length; count++)
            {
                var chkBox = document.createElement("input");    
                chkBox.Type = "checkbox";
                chkBox.id = "chk_"+count;
                chkBox.name = "chk_"+count;            
                var objTextNode = document.createTextNode(" " + tableNodes[count].childNodes(2).firstChild.data);
                var objLabel = document.createElement("label");
                objLabel.htmlFor = chkBox.id;
                objLabel.appendChild(chkBox);
                objLabel.appendChild(objTextNode);
                var objBreak = document.createElement("br");
                TagTDa.appendChild(objLabel);
                TagTDa.appendChild(objBreak);    
             }
    please chcek if something is wrong in code...

    Regards,
    Raina.D
    I was born intelligent,
    But Google ruined me.

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    chkBox.type = "checkbox"; ??
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    Born to Code rainadaman's Avatar
    Join Date
    Feb 2005
    Location
    india
    Posts
    793
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OH .....GOD....Kill me ...
    I wasted 2 hrs on this silly mistake...



    thnx buddy
    I was born intelligent,
    But Google ruined me.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •