Results 1 to 4 of 4

Thread: Create radio button

  1. #1
    Join Date
    Nov 2009
    Posts
    333

    Create radio button

    Hi friends
    I wrote a program that has a button on it, when I press that button the scripts activates and creates new radio buttons. The problems is that I want the radio button to be of the class draggable. I have posted my code below.
    Code:
    <script Language="JavaScript">
    function modify(){
    var newe= document.createElement("radio")
    newe.id = "newradio"
    newe.appendChild(newe)
    document.body.appendChild(newe)
    document.getElementById("emphasis1").childNodes[0].nodeValue = "first "
    }
    </script>
    Any help or suggestion will be appreciated. Thanks

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Create radio button

    Hello
    If you are talking about the CSS class. Then setAttribute should work fine with your problem. I have posted the part of the code, I have not tested it. but it may help you.
    Code:
    newElem.setAttribute("class", "draggable")
    Any more problem then do post back.

  3. #3
    Join Date
    Nov 2009
    Posts
    333

    Re: Create radio button

    Hi
    Thanks for the reply. That works fine without any errors. But sorry it still does not display a radio button on the page. I am not that experienced to javascript and any advice is appreciated. Please help

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: Create radio button

    Hi
    I think you have to append it to the DOM when you have done creating it. I feel that the input element which you need will be in the form. It will be good rather than adding it to the body element. See the statement below
    Code:
    document.forms[0].appChild(newElem);
    You have this
    Code:
    newElem.appChild(newElem)
    But I am not sure what will happen when you add an element to itself. Still you try it and any query post back. Even if you have solved it do post back with the solution.

Similar Threads

  1. Radio Button is not working properly in Excel
    By Raju Chacha in forum Windows Software
    Replies: 2
    Last Post: 07-01-2012, 09:06 PM
  2. Replies: 5
    Last Post: 02-05-2011, 01:05 AM
  3. Convert information to radio button
    By KADEEM in forum Software Development
    Replies: 3
    Last Post: 31-10-2009, 02:47 PM
  4. Dell laptop tells me to switch ON radio button
    By Mindstorm in forum Portable Devices
    Replies: 3
    Last Post: 18-08-2009, 07:39 PM
  5. Create a Button on the desktop
    By Benjycool in forum Customize Desktop
    Replies: 5
    Last Post: 06-03-2009, 11:15 AM

Tags for this Thread

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
  •  
Page generated in 1,711,624,276.12804 seconds with 16 queries