Created
November 8, 2016 08:57
-
-
Save bonaxcrimo/346e945b376617318651167848192c76 to your computer and use it in GitHub Desktop.
Alert ketika inputbox kosong
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Alert</title> | |
</head> | |
<body> | |
<input type="text" name="" id="nama"> | |
<button onclick="cek()">Kirim</button> | |
<script type="text/javascript"> | |
function cek(){ | |
var nama=document.getElementById("nama"); | |
if(nama.value.trim() == "") | |
alert("Tidak boleh kosong"); | |
else | |
alert("Nama anda "+nama.value); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment