-2

Sorry for the vague question... didn't give nearly enough info. Understand I need javascript, the main issue is what the syntax is

In HTML, I am trying to create conditional logic that checks if a button in a modal has been clicked, once that button has been clicked, I want to "show" a new button to the user

My issue is the syntax creating the new button using javascript. I have the onclick attribute of the triggering button set to a new function called "myFunction()" that I will place javascript in, but not sure syntactically how to generate a new button

Would something like this create the button?:

function myFunction() {
            var element = document.createElement("getInfo");
}

From here I need to assign a name, style, etc. to this button (hopefully using the same bootstrap styling the other buttons have on my webpage)

FS_woods
  • 33
  • 8
  • 1
    Hello. You should look at this link https://stackoverflow.com/help/how-to-ask to learn how to ask a complete question here on Stack Overflow. We encourage people to do research, attempt the problem, then post specific questions they are having trouble with – Michael Platt Oct 06 '17 at 19:48
  • javascript man javascript...! – Newton Sheikh Oct 06 '17 at 19:48
  • Which part of your code is not working? Creating the conditional? Checking if a button has been clicked? Creating a button? You need to narrow this down into something we can answer here. – takendarkk Oct 06 '17 at 19:48
  • "_not sure syntactically how to generate a new button_" When I googled for 'javascript create a button' I found [javascript to create a button with onclick](https://stackoverflow.com/questions/8650975/javascript-to-create-a-button-with-onclick) which should answer your question. – takendarkk Oct 06 '17 at 20:35

1 Answers1

0

Pretty much any sort of dynamic conditional content in HTML is going to require JavaScript, look into that.

Try looking here for an example: Add button to an HTML page using Javascript

Zachary Craig
  • 2,192
  • 4
  • 23
  • 34