Category

Jquery

Category

You can check this links https://github.com/carhartl/jquery-cookie Use this js code in your website <script type=”text/javascript” src=”//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js”> So you can read cookie like this: var value = $.cookie(“obligations”); Also, you can write cookie: $.cookie(‘obligations’, ‘new_value’); $.cookie(‘obligations’, ‘new_value’, { expires: 14, path: ‘/’ }); Delete cookie: $.removeCookie(‘obligations’);

var data = [ {“Id”: 10004, “PageName”: “club”}, {“Id”: 10040, “PageName”: “qaz”}, {“Id”: 10059, “PageName”: “jjjjjjj”} ]; $.each(data, function(i, item) { alert(data[i].PageName); }); $.each(data, function(i, item) { alert(item.PageName); });

<!DOCTYPE html> <html> <head> <title>Get unique values from array in Jquery – Real Programmer</title> <script src=”https://code.jquery.com/jquery-1.12.4.js”></script> </head> <body> <h1>Check unqiue value in console</h1> <script type=”text/javascript”> var user_name = [ “Siddharth”, “Saurabh”, “Siddharth”, “Yash”,”Yash”,”Saurabh” ]; var uniquename = user_name.filter(function(item, i, user_name) { return i == user_name.indexOf(item); }); console.log(uniquename); </script> </body> </html> <!– OUTPUT: (3) [“Siddharth”, “Saurabh”, “Yash”] –>

Remove Multiple Values from Array using JQuery So let’s see bellow simple example of jquery remove multiple values from an array. we will use Array.prototype.remove, grep() and inArray() for removing multiple values from array in jquery. checkout below code example. you can use easily with your JQuery Array. you can just see below example it’s done. you can easily use with your jquery array. <!DOCTYPE html> <html> <head> <title>Remove Multiple Values from Array Using Jquery</title>…

<!DOCTYPE html> <html> <head> <title>Jquery Remove Parent Table Row on Button Click Event: Real Programmer</title> <script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js”></script> </head> <body> <table> <tr> <th>ID</th> <th>Name</th> <th>Email</th> <th>Action</th> </tr> <tr> <td>1</td> <td>Siddharth</td> <td>[email protected]</td> <td><button class=”btn-remove”>Remove</button></td> </tr> <tr> <td>2</td> <td>Yash</td> <td>[email protected]</td> <td><button class=”btn-remove”>Remove</button></td> </tr> <tr> <td>3</td> <td>Chotu</td> <td>[email protected]</td> <td><button class=”btn-remove”>Remove</button></td> </tr> </table> <script type=”text/javascript”> $(document).ready(function () { $(“body”).on(“click”, “.btn-remove”, function(){ $(this).closest(‘tr’).remove(); }); }); </script> </body> </html>

Here I am going to show you toggle example using jquery toggle element. Example: <!DOCTYPE html> <html> <head> <title>Toggle in Jquery Hide and show -Real Programmer</title> <script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js”></script> <style type=”text/css”> .display-none{ display: none; } </style> </head> <body> <button class=”toggle”>Show</button> <div id=”example” class=”display-none”> Jquery tutorial Real Programmer </div> <script type=”text/javascript”> $(“.toggle”).click(function(){ $(“#example”).toggleClass(‘display-none’); }); </script> </body> </html>

With JQuery, we can get easily select option value onchange event in jquery. if you have a question like how to get select option value on change jquery than here you will have a simple example of getting selected value of dropdown in jquery on change event. In Jquery, we can get value from a selected value using onchange event in jquery. just click on the value you can easily get the value. In this…

Here I am showing how to select and unselect all checkbox using jquery Example: <html lang=”en”> <head> <title>Select and unselect all using jquery</title> <script src=”http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js”></script> </head> <body> <input name=”tutorial_all” class=”course-all” type=”checkbox”>Select All<br/> <input value=”1″ name=”course” class=”tutorial_list” type=”checkbox”>Course 1 <input value=”2″ name=”course” class=”tutorial_list” type=”checkbox”>Course 2 <input value=”3″ name=”course” class=”tutorial_list” type=”checkbox”>Course 3 <input value=”4″ name=”course” class=”tutorial_list” type=”checkbox”>Course 4 <input value=”5″ name=”course” class=”tutorial_list” type=”checkbox”>Course 5 <input value=”5″ name=”course” class=”tutorial_list” type=”checkbox”>Course 5 <input value=”5″ name=”course” class=”tutorial_list” type=”checkbox”>Course 5 <script…

Faster PHP Cloud Hosting