私はGo
ボタンで、次のhtmlドロップダウンメニューを持っています。最初の2つのオプション値を最初に選択してからGo
ボタンを押すとうまくいきますが、onclickイベントを持っている他の2つのオプション値では機能しません。 <option>
タグでonclickイベントを処理する方法、それぞれの警告メッセージを実行することができます。私はそれがGoogle Chromeブラウザで動作する必要があります。前もって感謝します。onclickイベントがhtmlのオプションタグで機能していませんか?
<html>
<head>
<script>
function third(){
alert("It is a third option event");
}
function fourth(){
alert("Fourth option value");
}
</script>
</head>
<form name="testform" id="testformid">
<select name="testdropdownmenu" >
<option value="" selected>Please Select</option>
<option value="https://www.w3schools.com">First Option</option>
<option value="https://www.google.co.in">Second Option</option>
<option onclick="third()">Third Option</option>
<option onclick="fourth()">Fourth Option</option>
</select>
<input type="button" name="go" value="Go" onClick="location=document.testform.testdropdownmenu.options
[document.testform.testdropdownmenu.selectedIndex].value;">
</form>
</html>
ご協力いただきありがとうございます。それは私の要件に役立ちます。 – Nag
AngularJS ng-changeイベントで同じことをする機会はありますか? – Nag