AmitDiwan has Published 10744 Articles

jQuery data() with Examples

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:15:54

627 Views

The data() method in jQuery is used to attach data to or gets data from selected elements.SyntaxThe syntax is as follows −$(selector).data(name) $(selector).data(name, value)Above, the name is the name of data to retrieve for the 1st syntax.For the 2nd syntax, the name is the name of data to set, whereas ... Read More

Set multiple values for custom columns in MySQL?

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:14:56

532 Views

For this, you can use UNION ALL. Let us first create a table −mysql> create table DemoTable1987    (    UserValue int    ); Query OK, 0 rows affected (2.90 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1987 values(4); Query OK, 1 row affected (0.22 ... Read More

Only display specified values inside the IN clause with MySQL?

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:13:56

117 Views

For this, you can use IN() along with ORDER BY clause. Let us first create a table −mysql> create table DemoTable1986    (    Number int    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1986 values(50); Query OK, ... Read More

jQuery index() with examples

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:13:05

273 Views

The index() method in jQuery is used to return the index position of specified elements relative to other specified elements.SyntaxThe syntax is as follows −$(selector).index()ExampleLet us now see an example to implement the jQuery index() method − Live Demo    $(document).ready(function(){       $("li").click(function(){       ... Read More

Date format to convert dates like Jan 2017, May 2018 to complete date in MySQL

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:11:30

200 Views

For this, use STR_TO_DATE() along with DATE_FORMAT(). Let us first create a table −mysql> create table DemoTable1985    (    DueDate varchar(20)    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1985 values('Jan 2017'); Query OK, 1 row affected ... Read More

jQuery toggleClass() with Examples

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:10:40

296 Views

The toggleClass() method in jQuery is used to toggle between adding or removing one or more classes from selected elements.SyntaxThe syntax is as follows −$(selector).toggleClass(classname, func(index, currentclass), switch)Above, class name specifies one or more class names to add or remove, whereas func is a function that returns one or more ... Read More

How to change the date in a table with date records with MySQL?

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:09:27

705 Views

Let’s say you need to change the date and add years. For this, use UPDATE command along with DATE_ADD(). Let us first create a table −mysql> create table DemoTable1984    (    ShippingDate date    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert ... Read More

How to insert a row with a timestamp “X days ago” in MySQL?

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:08:24

296 Views

To insert a row like this use the following syntax, wherein we are using CURRENT_TIMESTAMP −insert into yourTableName values(CURRENT_TIMESTAMP - INTERVAL ABS(RAND() * 100) DAY);To understand the above syntax, let us create a table −mysql> create table DemoTable1983    (    DueDate timestamp    ); Query OK, 0 rows affected ... Read More

jQuery removeData() with Examples

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:07:33

144 Views

The removeData() method in jQuery is used to remove the data set with the data() method.SyntaxThe syntax is as follows −$(selector).removeData(name)Above, the name parameter is used to specify the name of the data to remove.ExampleLet us now see an example to implement the jQuery removeData() method − Live Demo ... Read More

MySQL - changing table engine from innoDB to MyISAM?

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:06:19

350 Views

Let us first create a table −mysql> create table DemoTable1982    (    StudentId int    ,    StudentName varchar(20),    StudentAge int    ); Query OK, 0 rows affected (0.00 sec)Let us check the table engine type -mysql> show create table DemoTable1982;This will produce the following output −+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ... Read More

Advertisements