Skip to main content

Posts

Showing posts from June, 2017

jQuery - Chaining

JQuery Method Chaining: Until now we have been writing jQuery statements one at a time (one after the other). However, there is a technique called chaining, that allows us to run multiple jQuery commands, one after the other, on the same element(s). Tip:  This way, browsers do not have to find the same element(s) more than once. To chain an action, you simply append the action to the previous action. The following example chains together the css(), slideUp(), and slideDown() methods. The "p1" element first changes to red, then it slides up, and then it slides down: <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){     $("button").click(function(){         $("#p1").css("color", "red").slideUp(2000).slideDown(2000);     }); }); </script> &l

Filter With Checkbox Using Jquery

(1) SQL> create  database  test; (2)create table   product: CREATE TABLE IF NOT EXISTS `product` (   `id` int(25) NOT NULL AUTO_INCREMENT,   `name` varchar(250) NOT NULL,   `products` varchar(250) NOT NULL,   `brand` varchar(250) NOT NULL,   `price` varchar(250) NOT NULL,   `color` varchar(250) NOT NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=55 ; insert  some values... (3)write file  php database connectivity code for  config.php file: <?php $connection = mysql_connect('localhost', 'root',''); $db = mysql_select_db('test', $connection); ?> (4)write code for  main.php  file: <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $('.ids').on('change',function(){ //on checkboxes check //sending checkbox value into serialize form var hi=

Filter With Checkbox Using Jquery

(1) SQL> create  database  test; (2)create table   product: CREATE TABLE IF NOT EXISTS `product` (   `id` int(25) NOT NULL AUTO_INCREMENT,   `name` varchar(250) NOT NULL,   `products` varchar(250) NOT NULL,   `brand` varchar(250) NOT NULL,   `price` varchar(250) NOT NULL,   `color` varchar(250) NOT NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=55 ; (3)write file  php database connectivity code for  config.php file: <?php $connection = mysql_connect('localhost', 'root',''); $db = mysql_select_db('test', $connection); ?> (4)write code for  main.php  file: <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $('.ids').on('change',function(){ //on checkboxes check //sending checkbox value into serialize form var hi=$('.ids:checked&#

Jquery example form to php passing form value

(1)write code for form.html file:- <!doctype html> <html lang="en"> <head> <title>passing form input value to php - BY OM SIR</title>   <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.1.min.js"></script> <script type="text/javascript"> $(document).ready(function (event) { // triggered when the form submitted $("#myform").submit(function(event) { event.preventDefault(); $("#response").empty(); $.ajax({ // URL to move the uploaded image file to server url: "pass.php", // Request type type: "POST", // To send the full form data data: new FormData(this), contentType: false,  processData:false,  // UI response after the file upload success: function(data) { $("#response").html(data); } }); }); // Triggered when the image changed (browse) // Function to show the image as a preview }); </script&

JavaScript Object Oriented

Let's Create an Object 1 2 3 function myObject(){   }; Congratulations, you just created an object. There are two ways to create a JavaScript object: they are 'Constructor functions' and 'Literal notation'. The one above is a Constructor function, I'll explain what the difference is shortly, but before I do, here is what an Object definition looks like using literal notation. 1 2 3 var myObject = {   }; Literal is a preferred option for name spacing so that your JavaScript code doesn't interfere (or vice versa) with other scripts running on the page and also if you are using this object as a single object and not requiring more than one instance of the object, whereas Constructor function type notation is preferred if you need to do some initial work before the object is created or require multiple instances of the object where each instance can be changed during the lifetime of the script. Let's continue