Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    radio button/check box - selecting default- problem DOM2

    var tbl=document.createElement('TABLE');
    var tr1=tbl.insertRow();
    var td1=tr1.insertCell();
    var rbtn1=document.createElement("<INPUT name='rbLop'>");// only with
    INPUT and type='radio' not allowing me even to select
    rbtn1.type='radio';
    rbtn1.id='rbtn1';
    //rbtn1.checked='checked';
    //rbtn1.checked;
    //rbtn1.checked='true';
    var rbtn2=document.createElement("<INPUT name='rbLop'>");
    rbtn2.type='radio';
    rbtn2.id='rbtn2';
    td1.appendChild(rbtn1);
    td1.appendChild(rbtn2);
    document.body.appendChild(tbl);


    in above code i want the first button to be selected by default. but in
    dom2 i am not able to do, but i am in bad need of it. please tell me
    the alternate way and i hope there should be some ways. urgent
    please............

    indeterminate is also not working

    http://www.w3.org/2001/12/DOM-Level-2-issues
    http://www.w3.org/TR/DOM-Level-2-HTML/html.html

  • #2
    Regular Coder
    Join Date
    Aug 2005
    Posts
    282
    Thanks
    0
    Thanked 0 Times in 0 Posts
    use

    Code:
    //rbtn1.checked='checked';
    //rbtn1.checked;
    //rbtn1.checked='true'; 
    
    rbtn1.checked = true; // a boolean value


  •  

    Posting Permissions

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