jQuery Input Selector

AmitDiwan
Updated on 05-Nov-2019 10:32:15

261 Views

The :input selector in jQuery is used to select all input elements.SyntaxThe syntax is as follows −$(":input")ExampleLet us now see an example to implement the :input selector −    .demo {       background-color: blue;       color: white;       border: 2px yellow dashed;    }    $(document).ready(function(){       $(":input").addClass("demo");    }); Login Student Name: Student ID: OutputThis will produce the following output −

jQuery Image Selector

AmitDiwan
Updated on 05-Nov-2019 10:26:24

317 Views

The :image selector in jQuery is used to select all input elements with type=”image”.SyntaxThe syntax is as follows −$(":image")ExampleLet us now see an example to implement the :image() selector −    .demo {       background-color: gray;       border: 2px yellow dashed;    }    $(document).ready(function(){       $(":image").addClass("demo");    }); Login Student Name: Student ID: Learn MySQL: OutputThis will produce the following output −

jQuery Hidden Selector

AmitDiwan
Updated on 05-Nov-2019 10:24:23

263 Views

The :hidden selector in jQuery is used to select all hidden elements.SyntaxThe syntax is as follows −$(":hidden")ExampleLet us now see an example to implement the :hidden() selector −    $(document).ready(function(){       $("h2:hidden").show();    }); Fill the form ID: Rank: Fav. Subjects: Maths: English OutputThis will produce the following output. Here, we are displaying the hidden element −

jQuery Header Selector

AmitDiwan
Updated on 05-Nov-2019 10:22:39

249 Views

The :header selector in jQuery is used to select all header elements to .SyntaxThe syntax is as follows −$(":header")ExampleLet us now see an example to implement the :header() selector −    .demo {       background-color: blue;       color: white;       font-size: 18px;       border: 2px orange solid;    }    $(document).ready(function(){       $(":header").addClass("demo");    }); Cricket Rankings ODI Rank Points Player 1 100 Virat Kohli 2 80 Steve Smith 3 75 David Warner 4 60 Kane Williamson 5 50 Ben Stokes 6 45 Rohit Sharma OutputThis will produce the following output −

Sum Values in MySQL from Similar Day Records

AmitDiwan
Updated on 05-Nov-2019 10:19:27

876 Views

Use GROUP BY and DATE() for this. Let us first create a table −mysql> create table DemoTable1358     -> (     -> PurchaseDate datetime,     -> ProductPrice int     -> ); Query OK, 0 rows affected (1.59 sec)Insert some records in the table using insert command. Here, we have inserted date records, with some records with similar dates −mysql> insert into DemoTable1358 values('2019-09-20 12:34:00', 450); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable1358 values('2019-09-21 11:00:00', 1050); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable1358 values('2018-09-21 02:10:00', 2050); Query OK, 1 ... Read More

jQuery :has() Selector with Example

AmitDiwan
Updated on 05-Nov-2019 10:19:03

173 Views

The :has() selector in jQuery is used to select elements that contain at least one element matching the specified selector.SyntaxThe syntax is as follows −$(":has(selector)")Here, the parameter selector specifies the element to select.ExampleLet us now see an example to implement the :has() selector −    .demo {       background-color: blue;       color: white;       font-size: 18px;       border: 2px orange solid;    }    $(document).ready(function(){       $("tr:has(th)").addClass("demo");    }); Result Rank Points Player 1 100 Virat Kohli 2 80 Steve Smith 3 75 David Warner 4 60 Kane Williamson 5 50 Ben Stokes 6 45 Rohit Sharma OutputThis will produce the following output −

Display Result with Not Null Value First in MySQL

AmitDiwan
Updated on 05-Nov-2019 10:18:06

371 Views

Let us first create a table −mysql> create table DemoTable1357     -> (     -> StudentName varchar(40),     -> StudentCountryName varchar(30)     -> ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1357 values('Chris', 'US'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable1357 values('David', NULL); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1357 values('David', 'AUS'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1357 values('Carol', NULL); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1357 values('Mike', ... Read More

jQuery GT Selector

AmitDiwan
Updated on 05-Nov-2019 10:16:43

258 Views

The :gt() selector in jQuery is used to select elements with an index greater than mentioned in the index parameter.SyntaxThe syntax is as follows −$(":gt(index)")Here,The parameter index is the specified index. The elements above this index is selected.ExampleLet us now see an example to implement the :gt() selector −    .demo {       background-color: blue;       color: white;       font-size: 18px;       border: 2px orange solid;    }    $(document).ready(function(){       $("tr:gt(2)").addClass("demo");    }); Result Rank Points Player 1 100 Virat Kohli 2 80 Steve Smith 3 75 David Warner 4 60 Kane Williamson 5 50 Ben Stokes 6 45 Rohit Sharma OutputThis will produce the following output −

Alter Table Column from Varchar to NULL in MySQL

AmitDiwan
Updated on 05-Nov-2019 10:15:48

512 Views

To alter, use the ALTER command with CHANGE as in the below syntax −alter table yourTableName change yourColumnName yourColumnName datatype NULL DEFAULT NULL;Let us first create a table −mysql> create table DemoTable1356     -> (     -> FirstName varchar(30)     -> ); Query OK, 0 rows affected (0.56 sec)Let us implement the above syntax to alter a table column to NULL −mysql> alter table DemoTable1356 change FirstName FirstName varchar(30) NULL DEFAULT NULL; Query OK, 0 rows affected (0.17 sec) Records: 0  Duplicates: 0  Warnings: 0Insert some records in the table using insert command −mysql> insert into DemoTable1356 ... Read More

MySQL Query to Return All Items in a Single Row

AmitDiwan
Updated on 05-Nov-2019 10:14:31

1K+ Views

For this, use GROUP_CONCAT(). Let us first create a table−mysql> create table DemoTable1355     -> (     -> Location text     -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1355 values('E:'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1355 values('AllPrograms'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1355 values('ChatApplicationInJava'); Query OK, 1 row affected (0.38 sec) mysql> insert into DemoTable1355 values('MainFolder'); Query OK, 1 row affected (0.23 sec)Display all records from the table using select statement −mysql> select * ... Read More

Advertisements