Knowledge Walls
Ammu
Hyderabad, Andhra Pradesh, India
Passcode:
JQuery Selectors in JQuery of JQuery
1230 Views
sample
	<!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>
example2
	<!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>
Multiple selector
	!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>
Next Topics
Next lessons of current book.
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
Previous Topics
Previous lessons of current book.
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
Best Lessons of "JQuery"
Top lessons which are viewed more times.
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details