How To Get Alert From Chosen Select Option in Javascript

How to alert from chosen select option - javascript

Hello guys, welcome to the Today I’m going start another tutorial series for most asking questions in forums and social media. I also have got some problems and asked from forums, Sometimes I get the correct answer. But sometimes don’t. However, from today, I’m going to post solutions for problems which I got and most asked questions of developers.

This is my chosen first thing. I tried so many options but didn’t work when I was working my final project. I searched on google and found some posts, but didn’t work. However, this is what I got finally.

function myFunction() {
var x = document.getElementById(“mySelect”);
var i = x.selectedIndex;
document.write(‘hello orange’);

alert(‘hello pineapple’);


<select id=”mySelect” onchange=”myFunction()”>

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: