Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 24-11-2009
Member
 
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
Reply With Quote
  #2  
Old 24-11-2009
Member
 
Join Date: May 2008
Posts: 2,293
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.
Reply With Quote
  #3  
Old 24-11-2009
Member
 
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
Reply With Quote
  #4  
Old 24-11-2009
Member
 
Join Date: May 2008
Posts: 2,293
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Create radio button"
Thread Thread Starter Forum Replies Last Post
Radio Button is not working properly in Excel Raju Chacha Windows Software 2 07-01-2012 09:06 PM
Wi-Fi radio button of Toshiba Satellite a665 S6050 is not working Eugenia Portable Devices 5 02-05-2011 01:05 AM
Convert information to radio button KADEEM Software Development 3 31-10-2009 02:47 PM
Dell laptop tells me to switch ON radio button Mindstorm Portable Devices 3 18-08-2009 07:39 PM
Create a Button on the desktop Benjycool Customize Desktop 5 06-03-2009 11:15 AM


All times are GMT +5.5. The time now is 10:58 AM.