Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9070833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:47:02+00:00 2026-06-16T17:47:02+00:00

i am adding a input file tag and a link using a javascript function,

  • 0

i am adding a input file tag and a link using a javascript function, works great. Now i want to add also a radio button and a text whit this radio… i can add the radio whit no problems, but the text… idk how.

here is the code…

addCampo = function () {  
    nDiv = document.createElement('div');
    nDiv.className = 'archivo';
    nDiv.id = 'file' + (++numero);


    nCampo = document.createElement('input');
    nCampo.name = 'archivos[]';
    nCampo.type = 'file';

    a = document.createElement('a');
    a.name = nDiv.id;
    a.href = '#';
    a.onclick = elimCamp;
    a.innerHTML = ' Eliminar';

    portada = document.createElement('input');
    portada.name = 'portada';
    portada.type = 'radio';
    portada.value = '1';

    nDiv.appendChild(nCampo);
    nDiv.appendChild(portada);

    // HERE I WANT A SIMPLE TEXT SAYING WHATS DOES THE RADIO =) 

    nDiv.appendChild(a);

    container = document.getElementById('adjuntos');
    container.appendChild(nDiv);
}

this is working just fine! the only thing i dont know is how to add text whitout tags…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:47:03+00:00Added an answer on June 16, 2026 at 5:47 pm

    You need

    text = document.createTextNode('what the radio does');
    nDiv.appendChild(text);
    

    Although it’s better to use a label, because then you don’t have to sharp-shoot the radio button. In that case you’d need:

    portada.id = 'portada';
    text = document.createElement('label');
    text.innerText = 'what the radio does';
    text.for = 'portada';
    nDiv.appendChild(text);
    

    Edit: as mentioned in the comments, innerText is not necessarily supported by all browsers, sorry! Just use innerHTML instead, use textContent if you don’t care about old versions of IE, or create a text node and add it to the label node.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes, when uploading files using <input> tag, I encounter problem where the file extension
I'm dynamically adding value of an input tag. The values are returned from the
I think about adding possibility of using same the filename for both input and
I am adding HTML input controls on the page dynamically via a add text
I am having issue in checking which input has been clicked using unobstructive javascript.
In an html page ,I am adding an input element. <input type=file name=fileselect id=fselect>
I am adding file import functionality to an existing page. I want to do
I'm trying to modify this: jquery desktop by adding a input field inside one
I have a form where you have to add an image, either by adding
Can we detect whether a browser supports dropping a file over an <input type=file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.