Knowledge Walls
Ammu
Hyderabad, Andhra Pradesh, India
Passcode:
Getandset in JQuery of JQuery
927 Views
example
	<!DOCTYPE html>

	<head>

	    <title> Learning how to access elements from</title>

	    <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>

	    <script>

	        $(document).ready(function(){

	           $("#do_action").click(function() {

	              alert($("#my_text").val());

	              $("#my_text").val("hi");

	               

	              alert($("#do_action").html());

	              $("#do_action").html("My Action");

	               

	              alert($("#kw_link").attr("target"));

	              $("#kw_link").attr({"target": "_self", "title":"KNWalls"});

	           });

	        });

	    </script>

	    

	    <style>

	        .colorme { 

	            background-color: red;

	        }

	    </style>

	</head>

	<body>

	   Welcome to JQuery

	    <input type="text" id="my_text" value="hello">

	    <button id="do_action">Action</button>

	    <a id="kw_link" href="https://www.knowledgewalls.com" target="_blank">KnowleWalls</a>

	</body>

	</html>
example 2
	<!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").click(function(){

	                    $("#b1").html("button message changed");

	                    $("#text1").val("changed");

	                    $("#b1").attr({"title":"attr changed"});

	                    alert();

	                });

	            });

	        </script>

	 

	</head>

	 

	<body>

	    <p style="background-color: red;">hello</p>

	    <input type="text" id="text1" value="adk">

	    <button id="b1">button message</button>

	</body>

	 
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