Saturday, July 22, 2017

HOW TO CREATE ACCORDION BY JQUERY

<!doctype html> <head> <link rel="stylesheet" href="jquery-ui.css"> <link rel="stylesheet" href="style.css"> <script src="jquery-1.12.4.js"></script> <script src="jquery-ui.js"></script> <script> $( function() { $( "#accordion" ).accordion(); } ); </script> </head> <body> <div id="accordion"> <h3>Section </h3> <div> <p> It is a long established fact that a reader will be distracted by the readable content
of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less
normal distribution of letters, </p> </div> <h3>Section 2</h3> <div> <p> There are many variations of passages of Lorem Ipsum available, but the majority have suffered
alteration in some form, by injected humour </p> </div> <h3>Section 3</h3> <div> <p> It is a long established fact that a reader will be distracted by the readable content of a
page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less
normal distribution of letters, </p> </div> </div> </body> </html>

HOW TO DISABLE RIGHT CLICK AND CUT,COPY,PASTE



<body> <h1 class="disable" >hey Myself Niraj Kumar </h1> </body> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script> $('body').bind("cut copy paste", function(e) { alert('Cut Copy Paste is disabled..'); e.preventDefault(); }); </script> <script> $('.disable').bind("cut copy paste", function(e) { alert('Cut Copy Paste is disabled..'); e.preventDefault(); }); </script>

HOW TO SEE PREVIEW OF IMAGES BEFORE UPLOAD

<form id="form"> <input type='file' id="file" /> <br/> <span style="color:red"> Note: Please select only image file (eg: .png, .jpeg, .jpg, .gif etc)</span><br/> <img id="img" src="http://placehold.it/200x200" alt="No image uploaded" /> </form> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script> $(function() { $("#file").change(function () { readImgPath(this); }); // read image path function readImgPath(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { $('#img').attr('src', e.target.result); } reader.readAsDataURL(input.files[0]); } } }) </script>

HOW TO EXPORT TABLE TO EXCEL FORMATE BY JQUERY

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <script src="jquery.table2excel.js"></script> <script> $(function() { $(".download").click(function() { $(".tb2excel").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "file_name", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); }); }); </script> <table class="tb2excel" border=1> <tr><th>S.No.</th><th> Name</th><th> Email</th><th> Phone</th><tr> <tr><td>1</td><td> Niraj Singh</td><td> nirajsgh15@gmail.com</td><td> 1000000000</td><tr> <tr><td>3</td><td> Astha Kumari</td><td> ma@abc.in</td><td> 1000000001</td><tr> <tr><td>3</td><td> Sagar Kumar</td><td> abc@gmail.com</td><td> 1000000011</td><tr> <tr class="noExl"><td>..</td><td> ..</td><td> ..</td><td> ..</td><tr> </table> <h3><a href="#" class="download">Export Excel</a></h3>

HOW TO CREATE PASSWORD STRENGTH METER BY JQUERY




<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script type="text/javascript" src="jquery.complexify.min.js"></script> <script type="text/javascript"> $(function(){ $("#pass").complexify({}, function(valid, complexity){ //console.log("Password complexity: " + Math.round(complexity)); $("#pg").val(Math.round(complexity)); $("#cpx").html(Math.round(complexity)+'%'); }); }); </script> Enter Storng Password: <input type="password" id="pass"><br/> <progress value="0" max="100" id="pg"></progress> <span id="cpx">0%</span>

HOW TO CHECK INTERNET CONNECTION IS WORKING OR NOT BY JQUERY




<button onclick="checkInternetCon()">Check Internet Connection</button> <script> function checkInternetCon() { var status = navigator.onLine; if (status) { alert("Yes!! Working"); } else { alert("Sad!! Not Working "); } } </script>

HOW TO CREATE DATE PICKER BY JQUERY


<!doctype html> <head> <link rel="stylesheet" href="jquery-ui.css"> <link rel="stylesheet" href="style.css"> <script src="jquery-1.12.4.js"></script> <script src="jquery-ui.js"></script> <script> $( function() { $( "#datepicker" ).datepicker({ changeMonth: true, changeYear: true }); } ); </script> </head> <body> <p>Date: <input type="text" id="datepicker"></p> </body> </html>

HOW TO CREATE QR CODE BY JQUERY

<h1>QR Code Generator</h1> <p><textarea name="txt" style="height:50px;width:350px;" required="required"></textarea></p> <p>Image Size : <select name="size"> <option value="100x100">100x100</option> <option value="200x200" selected>200x200</option> <option value="300x300">300x300</option> <option value="400x400">400x400</option> </select></p> <p><input type="submit" value="Generator QR Code" id="qr-gn"></p> </div> <br/> <div id="qrcode"></div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> <script type="text/javascript" src="jquery.qrcode.min.js"></script> <script> $(function(){ $("#qr-gn").click(function(){ $("#qrcode").html(""); var txt = $.trim($('textarea[name="txt"]').val()); if(txt == '') { alert("Please enter text you want to embed in OR Code"); return false; } var size = $('select[name="size"]').val(); var sizeSplit = size.split('x'); var width = sizeSplit[0]; var height = sizeSplit[1]; generateQRcode(width, height, txt ); return false; }); function generateQRcode(width, height, text) { $('#qrcode').qrcode({width: width,height: height,text: text}); } }); </script>

HOW TO CREATE COLOR PICKER BY JQUERY

<!DOCTYPE html> <head> <link rel="stylesheet" href="css/colorpicker.css" type="text/css" /> <link rel="stylesheet" media="screen" type="text/css" href="css/layout.css" /> <script type="text/javascript" src="js/jquery.js"> <script type="text/javascript" src="js/colorpicker.js"> <script type="text/javascript" src="js/eye.js"> <script type="text/javascript" src="js/layout.js?ver=1.0.2"> </head> <body> <p id="colorpickerHolder"> </p> <div id="customWidget"> <div id="colorSelector2"><div style="background-color: #00ff00"></div> </div> <div id="colorpickerHolder2"> <div id="colorSelector"><div style="background-color: #0000ff"></div> </div> </div> </div> </body> </html>