AmitDiwan has Published 10744 Articles

Set an alternative of WHERE clause for each SELECT field in MySQL

AmitDiwan

AmitDiwan

Updated on 02-Jan-2020 05:15:50

507 Views

You can use CASE statement −mysql> create table DemoTable1988    (    Value1 int,    Value2 int,    Price int    ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1988 values(10, 7, 500); Query OK, 1 row affected (0.21 ... Read More

Convert DATE timestamp to return the month number

AmitDiwan

AmitDiwan

Updated on 02-Jan-2020 05:13:03

219 Views

To return only the month number, you can use DATE_FORMAT() -mysql> create table DemoTable1999    (    ArrivalDate timestamp    ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1999 values('2019-01-01 12:34:00'); Query OK, 1 row affected (0.18 sec) mysql> ... Read More

Setting Background Position using CSS

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 10:46:14

80 Views

Background position is to set the beginning position of a background image. For this, use the background-position property.ExampleLet us now see an example − Live Demo body {    background-image: url("https://www.tutorialspoint.com/images/Swift.png");    background-repeat: no-repeat;    background-attachment: fixed;    color: blue;    background-position: left center; } .demo {   ... Read More

jQuery Misc get() Method

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 09:33:09

139 Views

The get() method in jQuery is used to get the DOM elements matched by the selector.SyntaxThe syntax is as follows −$(selector).get(index)Above, the index specifies which of the matching elements to get.Let us now see an example to implement the jQuery get() method −Example Live Demo    $(document).ready(function(){   ... Read More

jQuery Misc each() Method

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 09:29:42

184 Views

The each() method in jQuery is used to execute a function for each matched element.SyntaxThe syntax is as follows −$(selector).each(function(index, ele))Above, the index is the position of the selector, whereas ele is the current element.Let us now see an example to implement the jQuery each() method −Example Live Demo ... Read More

jQuery length property

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 09:25:52

353 Views

The length property in jQuery is used to get the number of elements in the jQuery object.SyntaxThe syntax is as follows −$(selector).lengthExampleLet us now see an example to implement the jQuery length property − Live Demo    $(document).ready(function(){       $("button").click(function(){          document.getElementById("demo").innerHTML = ... Read More

jQuery Traversing Ancestors

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 09:23:39

265 Views

To traverse and find ancestors of an element, jQuery has the following methods: parent(), parents() and parentsUntil()−parent() methodThe parent() method in jQuery is used to return the direct parent element of the selected element. Let us see an example −Example Live Demo div {    width:600px; } .demo ... Read More

jQuery Misc toArray() Method

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 09:14:34

142 Views

The toArray() method in jQuery is used to get all the DOM elements contained in the jQuery set, as an arraySyntaxThe syntax is as follows −$(selector).toArray()Let us now see an example to implement the jQuery toArray() method −Example Live Demo    $(document).ready(function(){       $("button").click(function(){     ... Read More

jQuery is() Method

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 09:11:50

296 Views

The is() method in jQuery is used to check whether one of the selected elements matches the value in parameter selectorEle.SyntaxThe syntax is as follows −$(selector).is(selectorElement, func(index, element))Above, selectorEle is a selector expression, element or jQuery object to match with the current set of the element. The func parameter is ... Read More

jQuery removeProp() with Examples

AmitDiwan

AmitDiwan

Updated on 31-Dec-2019 08:18:43

198 Views

The removeProp() method in jQuery is used to remove a property set by the prop() method.SyntaxThe syntax is as follows −$(selector).removeProp(property)Above, the parameter property is the name of the property to remove.ExampleLet us now see an example to implement the jQuery removeProp() method − Live Demo    $(document).ready(function(){ ... Read More

Advertisements