Assalamu'alaikum wr wb
kali ini saya akan share bagaimana caranya merubah background input text ketika diinput.
Berikut ini syntaxnya.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("input").keydown(function(){
$("input").css("background-color","yellow");
});
$("input").keyup(function(){
$("input").css("background-color","pink");
});
});
</script>
</head>
<body>
Enter your name: <input type="text">
<p>Enter your name in the input field above. It will change background color on keydown and keyup.</p>
</body>
</html>
Semoga bermanfaat.
http://pangeran-it.blogspot.com/
Referensi : http://www.w3schools.com/
Cara merubah backgrund input text saat di input
Reviewed by Syawaluddin Amin, S.Kom
on
September 23, 2014
Rating:
Tidak ada komentar: