Posts

How to Create Filters using jQuery

Image
Example:- Method of Filter Tables <html> <head> <title>Filter Table<title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#myInput").on("keyup", function() { var value = $(this).val().toLowerCase(); $("#myTable tr").filter(function() { $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) }); }); }); </script> <style> table { font-family: arial, sans-serif; border-collapse: collapse; width: 100%; } td,th { border: 1px solid #dddddd; text-align: left; padding: 8px; } </style> </head> <body> <h2>Filter Table</h2> <p>Type something in input box to search the table for first names, last names or emails:</p> <input id="myInput" type="text" placeholder="Search.."> <br><br&g

How to Create Remove Element or Content using jQuery

Image
jQuery remove() Method Example:- <html> <head> <title>jQuery remove()</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("#div1").remove(); }); }); </script> </head> <body> <div id="div1" style="height:100px;width:300px;border:1px solid black;background-color:red;color:#ffffff"> <p>Welcome to Hub of Tutorials</p> <p>jQuery remove Method.</p> </div> <br> <button>Remove div element</button> </body> </html> jQuery empty() Method Example:- <html> <head> <title>jQuery empty()</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button"

How to Add New HTML Content using jQuery

Image
Four  jQuery  Methods for add new content. append() prepend() after() before() jQuery append() method <html> <head> <title>jQuery append() Method</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#btn1").click(function(){ $("p").append(" <b>Appended text</b>."); }); $("#btn2").click(function(){ $("ol").append("<li>Appended item</li>"); }); }); </script> </head> <body> <p>paragraph.</p> <p>another paragraph.</p> <ol> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ol> <button id="btn1">Append text</button> <button id="btn2">Append list items</button> </body> </html> jQuery prepen

How to Create Get Content and Attributes in jQuery

Image
Get Content text() html() val() Example:- <html> <head> <title>Get Content</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#btn1").click(function(){ alert("Text: " + $("#test").text()); }); $("#btn2").click(function(){ alert("HTML: " + $("#test").html()); }); }); </script> </head> <body> <p id="test">In this paragraph having some<b>bolded</b> text.</p> <button id="btn1">Show Text</button> <button id="btn2">Show HTML</button> </body> </html> Example 2:- <html> <head> <title>Get Content</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(documen

How to Create Callback Function in jQuery

Image
Example:- <html> <head> <title>Callback Function in jQuery</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").hide("slow", function(){ alert("The paragraph is now hidden"); }); }); }); </script> </head> <body> <button>Click to Hide</button> <p>Welcome to Hub of Tutorials.</p> </body> </html> Read Full article

How to Create a start and stop Function using jQuery

Image
Example:- <html> <head> <title>start() and stop() Function using jQuery</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#start").click(function(){ $("#panel").slideDown(5000); }); $("#stop").click(function(){ $("#panel").stop(); }); }); </script> <style> #panel, #flip { padding: 5px; font-size: 18px; text-align: center; background-color: Red; color: white; border: solid 1px #666; border-radius: 3px; } #panel { padding: 50px; display: none; } </style> </head> <body> <button id="start">Start sliding</button> <button id="stop">Stop sliding</button> <div id="flip">Welcome to Hub of Tutorials</div> <div id="panel">Start() and Stop() Function</div> </

How to Create Sliding Method using jQuery

Image
Example:- <html> <head> <title>Sliding Method in jQuery</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideToggle("slow"); }); }); </script> <style> #panel, #flip { padding: 5px; text-align: center; color:#ffffff; background-color: #e8002b; border: solid 1px #c3c3c3; } #panel { padding: 50px; display: none; } </style> </head> <body> <div id="flip">Click for slide panel down or up</div> <div id="panel">Welcome to Hub of Tutorials</div> </body> </html> Read Full article How to Create Fading Method using jQuery