Arief Siswanto
2022-10-22 09:00:33
<html>
<head>
<title>Belajar Javascript</title>
<script type="text/javascript" src="jquery-3.6.1.js"></script>
<script type="text/javascript">
const ambilNama = () => {
var fn = document.getElementById("fn");
var ln = document.getElementById("ln");
var kelas = document.getElementById("kelas");
let kelasText = kelas.options[kelas.selectedIndex].text;
kelasText = "x";
alert(fn.value + " " + ln.value + " " + kelasText);
};
</script>
</head>
<body>
First Name: <input type="text" id="fn" value="Arief" /><br />
Last Name: <input type="text" id="ln" value="Siswanto" /><br />
Kelas:
<select id="kelas">
<option value="1">RPL</option>
<option value="2">MM</option>
<option value="3">OTKP</option>
</select>
<br />
<button type="button" id="submit" onClick="ambilNama()">Kirim</button>
</body>
</html>
No reply found.