Category : jQuery


How to use each loop with class element of html in Jquery?

Whenever you need to use each loop in jquery then you can follow this example code. each with html class you can get whole object of that class using $(this) jquery function. In following example you can see i get attribute data-id using $(this).data('id'), that means you can take current class data attribute value. <strong>Example:</strong> <pre class="code language-html"> <html lang="en"> <head> <title>Each Loop with Class Jquery</title> <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> </head> <body> .....

By Hardik Savani | March 4, 2016 | | 857 Viewer | Category : jQuery
READ MORE

How to get ckeditor value with tags on ajax-submit ?

If you are use ckeditor for textarea and you need to fore ajax submit or form js submit, but you can't find ckeditor value in your controller or php file. So, first you have to update field using CKEDITOR.instances. so you can try to following code. <pre class="language-javascript"> for ( instance in CKEDITOR.instances ) CKEDITOR.instances[instance].updateElement(); </pre>

By Hardik Savani | February 26, 2016 | | 1827 Viewer | Category : jQuery
READ MORE

How to get max attribute value in jquery?

Sometimes, you have a many tag with same class and attribute with value, but you need to find maximal value of attribute from that comman class, In bellow you have same html tag: <pre class="code language-html"> <ul> <li class="test" data-id="3">hi</li> <li class="test" data-id="5">hey</li> <li class="test" data-id="1">hello</li> </ul> </pre> Now, you require to get max value, i mean you need to 5, because that is big value from other, so you can get maximal value from this way: <pre class="language-javascript"> var max = 0; $('.test').each(fu.....

By Hardik Savani | February 23, 2016 | | 842 Viewer | Category : jQuery
READ MORE

Codeigniter Angularjs http post not working

Sometimes, you face problem you can't get post data using $this->input->post(), when you fire $http.post() using AngularJS or Jquery. I also face this issue, i can't receive post value when i fire $http.post in AngularJS, But i found how to receive post data or json data in Codeigniter controller. in following example through you can solve your problem: <pre class="language-php"> public function store() { $this->load->database(); $_POST = json_decode(file_get_contents('php://input'), true); $posts = $this->input->post(); $this->db->insert('posts', $posts); } </pre>

By Hardik Savani | February 22, 2016 | | 2466 Viewer | Category : jQuery
READ MORE

How to remove query string from URL using JQuery

<strong>Why remove query strings?</strong> Main two reasons for this. 1. Clear URL alwaya look better than the long URL 2. When you are not remove your query string from URL. then all get variable show in you URL string. sometime it not good for a security You can remove your query string using this simple Jquery code. <pre class="language-javascript"> $(document).ready(function(){ var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } }); </pre>

By Hardik Savani | February 17, 2016 | | 4018 Viewer | Category : jQuery
READ MORE

Crop, Resize, Frames etc on selected image in php using Aviary

Whenever you require to use any image plugin for select image and crop,resize,effects,frames,strickers ect, so you have to use Aviary api like as you see of facebook, twitter ect., that site plugin provide lots of efects and api guide that way you can use easily in your web app and as well as on mobile app too. So, I am going to give demo of how to use this api in our side. <strong>Preview:</strong> <img style="border:2px solid cadetblue;width:100%" src="/upload/selectimage.png"> <strong>Example</strong> <pre class="code language-html"> <html> <head> <title>Aviary Image U.....

By Hardik Savani | February 16, 2016 | | 4809 Viewer | Category : jQuery
READ MORE

How to set scroll to bottom in jquery?

Sometimes, we need to set scroll bottom as default by using jquery, in bellow example you can see i use scrollHeight for get the total height of scroll class div with scroll, and at last i use animate with scrollTop attribute and set bottom, So Basically when your page will load then automatically scroll as bottom. <strong>Example:</strong> <pre class="code language-html"> <html lang="en"> <head> <title>Scroll Down bottom</title> <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> </head> <body> <div cl.....

By Hardik Savani | February 11, 2016 | | 2323 Viewer | Category : jQuery
READ MORE

Check and Uncheck checkboxes using JQuery

Sometimes we need to Select and Deselect all checkboxes like you see on gmail if you check top checkbox then automatically select other all.So, we can do using jquery and its method prop().In Following example you can see how is that and use this example simply: <strong>Example:</strong> <pre class="code language-html"> <html lang="en"> <head> <title>Select and Deselect Checkbox</title> <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> </head> <body> <input name="subject_all" class="subject-all" type=.....

By Hardik Savani | February 10, 2016 | | 851 Viewer | Category : jQuery
READ MORE

How can i print php variable in jquery?

If you are working on php and you need to print your php variable inside the javascript then you can simple get value. you can use "" for get value of php variable. in following example you can see : <strong>Example:</strong> <pre class="code language-html"> <script type="text/javascript"> var my_var = "<?php echo $my_variable; ?>"; console.log(my_var); </script> OR <script type="text/javascript"> var my_var = <?php echo $my_variable; ?>; console.log(my_var); </script> </pre> But, you can use on php file, Not on js file.

By Hardik Savani | February 8, 2016 | | 1279 Viewer | Category : jQuery
READ MORE

Select only one checkbox at a time using Jquery

If you need to select one checkbox at a time in multiple checkbox, i mean you want to allow anly one checkbox user can check then you can do easily using jquery. jquery prop() through you can give attribute value checked equel to true or false. if you have banch of checkbox like as example, and if you want to check checkbox at time one by using jquery then you can use this code. In following example use for you to do select at a time one. <strong>Example:</strong> <pre class="code language-html"> <html> <head> <title>Select only one checkbox at time</title> <scri.....

By Hardik Savani | February 5, 2016 | | 18742 Viewer | Category : jQuery
READ MORE

    Laravel 5 and Vue JS CRUD with Pagination example and demo from scratch

    Laravel 5 and Vue JS CRUD with Pagination example and demo from scratch

    Open Post

    Jquery - Display a loading gif image before a image loads using Eager ImageLoader plugin

    Jquery - Display a loading gif image before a image loads using Eager ImageLoader plugin

    Open Post

    Laravel 5 custom pagination view example

    Laravel 5 custom pagination view example

    Open Post

    How to get last inserted id in Codeigniter?

    How to get last inserted id in Codeigniter?

    Open Post

    Laravel 5 - How to prevent browser back button after user logout?

    Laravel 5 - How to prevent browser back button after user logout?

    Open Post

    Laravel 5 - line chart example code using google charts API

    Laravel 5 - line chart example code using google charts API

    Open Post