How to create a button? | SoloLearn: Learn to code for FREE!


How to create a button?

I have a button called "Cars". When I place mouse over it displays dropdown list consisted of items: "BMW", "Mercedes", "VW", "KIA". I want to create a button (or something similar) next to the button Cars, when I click the specific item from a dropdown list. So, when I click BMW, I want it to look like this: Cars > BMW The same is for other items. That button shouldn't be displayed before clicking. Just onclick.

1/17/2017 5:53:23 PM


3 Answers

New Answer


It sounds like you're looking for someone to do your work for you... javacsript has an onclick event. Pair this with an InnerHTML write to change your DOM. Or, you can use jQuery .click() method with it's .html() method inside the click function.


i am not familiar with jQuery and dont want to learn it. i know for onclick event but it just doesn't work.. i wouldn't ask if i know how to do it, believe me, i would just write the bloody code.. inner html just change my Cars button to BMW not create a new beside the Cars..


write what you have now and link it here. I'll point out fixes when I'm not busy at work.