<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>internal</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
</head>
<body>
<script>
$(document).ready(function(){
$("button").click(function(){
var name=$("#t1").val();
console.log(name);
var cap=$(this).html();
console.log(cap);
})
});
</script>
<input type="text" id="t1">
<button>hello</button>
<button>hi</button>
</body>
</html>
|
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>internal</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
</head>
<body>
<script>
$(document).ready(function(){
$("#b1").click(function(){
var value=$("#t1").val();
$("h1").css("background-color",value);
$(".button1").css("background-color",value);
});
});
</script>
<style>
.button1{
background-color: red;
}
</style>
<h1 id="h1">hello</h1>
<input type="text" id="t1" value="hello">
<button class="button1" id="b1">hello</button>
<button class="button1" id="b2">hi</button>
</body>
</html>
|
!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>internal</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script>
$(document).ready(function(){
$("button").dblclick(function(){
$("#p1,#p2").css("background-color", "red");
//$("#p2").css("background-color", "red");
console.log("button db clicked");
});
});
</script>
</head>
<body>
<button id="p1" style="background-color: orange;">Red</button>
<p id="p2">change color to red</p>
</body>
</html>
|