Category : Javascript


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 | | 619 Viewer | Category : Javascript
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 | | 1210 Viewer | Category : Javascript
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 | | 565 Viewer | Category : Javascript
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 | | 2921 Viewer | Category : Javascript
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 | | 971 Viewer | Category : Javascript
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 | | 6790 Viewer | Category : Javascript
READ MORE

How to check undefined, empty and null in JavaScript/JQuery ?

If you are working on jquery and However you want to check variable is undefined or not then you can easily check by typeof operator, which is simple, fast and cross-platform: <pre class="language-javascript"> if(typeof i == "undefined"){ alert('undefined'); } </pre> If you are working on jquery and However you want to check variable is empty or not then you can easily check by compare with empty string: <pre class="language-javascript"> if(i == ''){ alert('Empty'); } </pre> If you are working on jquery and However you want to check variable is null or not then you can easily che.....

By Hardik Savani | January 12, 2016 | | 579 Viewer | Category : Javascript
READ MORE

How to convert line breaks to br in jQuery ?

If you are use textarea and you want to like break into br(\n) so that way we can give format as user insert, but if you are working on php then you can easily doing with nl3br() through, but if you are using in jquery or javascript then you have to first declare that. i did give full example of jquery textarea line breaks as under. <pre class="code language-html"> <body> <textarea class="textareac"></textarea> <script> var text_content = <?php echo $content ?>; function nl2br (str, is_xhtml) { var breakTag = (is_xh.....

By Hardik Savani | January 9, 2016 | | 755 Viewer | Category : Javascript
READ MORE

How to check Object is empty or not in Jquery/JavaScript ?

you can check your JavaScript OR jQuery object is empty or not, because we need to check many place our jQuery object is empty, null or undefined etc., So usually, we can check using $.isEmptyObject() as i explained as under. how to check empty object in javascript, how to check empty object in jquery, jQuery.isEmptyObject() example, jquery check object is null, jquery check object is empty, jquery check object is empty or not, how to check json object is empty or not in jquery, check if json object is empty jquery <pre class="language-javascript"> if($.isEmptyObject(your_object)){ alert(.....

By Hardik Savani | January 8, 2016 | | 8808 Viewer | Category : Javascript
READ MORE

How to get Lat and Lon from google map API in Jquery PHP?

if you are working on php, asp or any other framwork and you want to integrate google API and also you want to get Latitude and Longitude for location. we have mostly fetch some problem when we set google map because i tried and i also fetch problem. but i am giving you with search location and get Latitude and Longitude of that location. you have to use html file, css file and js file as i write under and use them in your system. first you have to create simple html file. so create folder in your system and create new index.html file and copy index.html file as i give you under. <strong>Inde.....

By Hardik Savani | January 6, 2016 | | 1795 Viewer | Category : Javascript
READ MORE

    How to get last record from MySQL table in Codeigniter?

    How to get last record from MySQL table in Codeigniter?

    Open Post

    Codeigniter 3 - Generate PDF from view using dompdf library with example

    Codeigniter 3 - Generate PDF from view using dompdf library with example

    Open Post

    PHP - jquery ajax crop image before upload using croppie plugin

    PHP - jquery ajax crop image before upload using croppie plugin

    Open Post

    Codeigniter 3 - select2 ajax autocomplete from database example with demo

    Codeigniter 3 - select2 ajax autocomplete from database example with demo

    Open Post

    Laravel 5 import export to excel and csv using maatwebsite example.

    Laravel 5 import export to excel and csv using maatwebsite example.

    Open Post

    Laravel 5 - Bootstrap Admin Theme Integration example from scratch

    Laravel 5 - Bootstrap Admin Theme Integration example from scratch

    Open Post