Bootstrap 4 Border Secondary Class

Alex Onsman
Updated on 16-Jun-2020 11:56:36

229 Views

Use the border-secondary class in Bootstrap 4 to add a gray border to an element.Set the border as −   Gray border I have styled our element as shown in the following code snippet − .test {   width: 200px;   height: 150px;   margin: 10px; } You can try to run the following code to implement the border-secondary class −ExampleLive Demo       Bootstrap Example                             .test {       width: 200px;       height: 150px;       margin: 10px;     }       Rectangle   Gray border

Set and Get Cookies with JavaScript

Sreemaha
Updated on 16-Jun-2020 11:56:32

4K+ Views

Set CookieThe simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this:document.cookie = "key1=value1;key2=value2;expires=date";Here the “expires” attribute is optional. If you provide this attribute with a valid date or time, then the cookie will expire on a given date or time and thereafter, the cookies' value will not be accessible.ExampleTry the following. It sets a customer name in an input cookie.Live Demo                                                  Enter ... Read More

Create Cookies in JavaScript

Rishi Rathor
Updated on 16-Jun-2020 11:51:30

806 Views

Using cookies is the most efficient method of remembering and tracking preferences, purchases, commissions, and other information required for better visitor experience or site statistics.The simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this.document.cookie = "key1=value1;key2=value2;expires=date";Here the expires attribute is optional. If you provide this attribute with a valid date or time, then the cookie will expire on a given date or time and thereafter, the cookies' value will not be accessible.Note − Cookie values may not include semicolons, commas, or whitespace. For this reason, you may want to ... Read More

Create and Read a Value from Cookie in JavaScript

usharani
Updated on 16-Jun-2020 11:50:52

189 Views

Create cookiesThe simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this −document.cookie = "key1=value1;key2=value2;expires=date";Here the “expires” attribute is optional. If you provide this attribute with a valid date or time, then the cookie will expire on a given date or time and thereafter, the cookies' value will not be accessible.ExampleTry the following. It sets a customer name in an input cookie.Live Demo                                                 ... Read More

Sort Array of Objects Containing Null Elements in Java

Sai Subramanyam
Updated on 16-Jun-2020 11:50:33

2K+ Views

Whenever we try to sort elements with null values using the sort method it throws an exception.The sort() method of the Arrays class also accepts a Comparator along with the array. Using comparator, you need to specify the order in which the elements need to be sorted.Using this method push all the null elements to last and sort the elements −Example Live Demoimport java.util.Arrays; import java.util.Comparator; public class ArrayWithNullsInOrder { public static void main(String args[]) { String[] myArray = {"JavaFX", null, "OpenCV", null, "Hadoop", null}; Arrays.sort(myArray, Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER)); System.out.println(Arrays.toString(myArray)); } }Output[Hadoop, JavaFX, OpenCV, null, null, null]Read More

Align Element with Parent Font in Bootstrap 4

Amit Diwan
Updated on 16-Jun-2020 11:50:05

279 Views

Use align-text-top class to align an element with the top of the parent element's font.Set the align-text-top class as −   Top Text You can try to run the following code to implement the align-text class in Bootstrap 4 −ExampleLive Demo       Bootstrap Example                         Example   This is demo text   Demo Baseline   Top Alignment   Top Text   Bottom Text

Set Cookies to Expire in 1 Hour in JavaScript

seetha
Updated on 16-Jun-2020 11:47:42

10K+ Views

You can extend the life of a cookie beyond the current browser session by setting an expiration date and saving the expiry date within the cookie. This can be done by setting the ‘expires’ attribute to a date and time.ExampleYou can try to run the following example to set cookies to expire in 1 hour −                                                  Enter name:                    

Trigger JavaScript Function After User Finishes Typing

Krantik Chavan
Updated on 16-Jun-2020 11:47:11

334 Views

To fire a JavaScript function when the user finishes typing, try to run the following code −Example                    var timer = null;          $("#myText").keydown(function(){             clearTimeout(timer);             timer = setTimeout(doStuff, 1000)          });          function doStuff() {             alert("Write more!");          }                

Check if a Given Graph is a Tree or Not

karthikeya Boyini
Updated on 16-Jun-2020 11:46:28

4K+ Views

In this problem, one undirected graph is given, we have to check the graph is tree or not. We can simply find it by checking the criteria of a tree. A tree will not contain a cycle, so if there is any cycle in the graph, it is not a tree.We can check it using another approach, if the graph is connected and it has V-1 edges, it could be a tree. Here V is the number of vertices in the graph.Input and OutputInput: The adjacency matrix. 0 0 0 0 1 0 0 0 0 1 0 0 0 ... Read More

Set Cookies Expiry Date in JavaScript

radhakrishna
Updated on 16-Jun-2020 11:46:10

5K+ Views

Extend the life of a cookie beyond the current browser session by setting an expiration date and saving the expiry date within the cookie. This can be done by setting the ‘expires’ attribute to a date and time.ExampleYou can try to run the following example to set the expiry date of a cookie by 1 Month −                                                  Enter name:                    

Advertisements