Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
114 views
in Technique[技术] by (71.8m points)

javascript - How to add name field on singup page?

I am using loginradius for one of my project (glossary app), and it is still in development phase but I want to ask name of user on registration page, by default on signup page only email and password fields are available. I don't know how to add name field on signup page. I saw that on singup page I can use JavaScript but not sure how to add fields using JavaScript too?

question from:https://stackoverflow.com/questions/66058122/how-to-add-name-field-on-singup-page

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use JavaScript DOM APIs to create a new name field and use that field for name on your registration page.

step 1: create an input field for name

var input = document.createElement("input");  
input.type = "text";

step 2: Append the input field to your registration form

document.getElementById("your registration form id").appendChild(input);

Now you have extra field available on your registration form which you can use to extract name value and send it to API as post data along with other field values.

Let me know if you need any other help in this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...