Linking radio buttons to drop down and on click button?

Linking radio buttons to drop down and on click button?

Hi guy’s i’m trying to figure out how to link my radio buttons up to my button and drop down list so that if i choose the difficult option i get an alert and if i choose the easy option i also get an alert depending on each drop down option I choose.


Confused about your wording here… what kind of “alert” are you trying to create? A browser alert? Or a different kind of alert somewhere else on the page? Also, you want this alert to happen when someone changes the radio button options? Or when they change the drop-down? Sorry, unclear to me what you’re asking…

Generally speaking if you want an alert to happen based on a user event you need to add an event listener to the element the user is interacting with e.g.

const radioBtn = document.querySelector('.myRadioBtn');
radioBtn.addEventListener('click', myFunc);

function myFunc(){
   alert('are you sure?')


Basically i’m trying to get when the user selects one of the drop downs, and then select easy , then click submit answer something should appear in the text field on the right side where it says hi on page load. Then if they select difficult instead of easy another word should appear.