Get & Set Content and Attributes

A. Get Attributes $("#btn1").click(function(){ alert("Text: " + $("#test").text()); }); $("#btn2").click(function(){ alert("HTML: " + $("#test").html()); }); $("button").click(function(){ alert($("#w3s").attr("href")); });   B. Set Attributes $("#btn1").click(function(){ $("#test1").text("Hello world!"); }); $("#btn2").click(function(){ $("#test2").html("<b>Hello world!</b>"); }); $("#btn3").click(function(){ $("#test3").val("Dolly…

0 Comments

Slide method in jquery

slideDown() slideUp() slideToggle() A. slideDown(): <script> $(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideDown("slow"); }); }); </script> <style> #panel, #flip { padding: 5px; text-align: center; background-color: #e5eecc; border: solid 1px #c3c3c3; } #panel { padding:…

0 Comments

jQuery fade

Fade means set visibility of html elements. fadeIn() fadeOut() fadeToggle() fadeTo() A. fadeIn(): <style> #div1, #div2, #div3 {  height:150px; width:150px;  display:nones; } #div1{ background:red; } #div2{ background:orange; } #div3{ background:purple;…

0 Comments

Hide, show & toggel jquery

A. Hide $("button").click(function(){ $("p").hide(1000); // 1 second takes time for hide }); B. Show $("button").click(function(){ $("p").show(1000); }); C. Toggle $("button").click(function(){ $("p").toggle(1000); });

0 Comments

jquery cdn

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>

0 Comments