Articles on Trending Technologies

Technical articles with clear explanations and examples

How to find all the siblings for the clicked element in jQuery?

Amit D
Amit D
Updated on 11-Mar-2026 834 Views

To find all the siblings for the clicked element in jQuery, use the parent and siblings method, and select the class to find all siblings.ExampleYou can try to run the following code to find all the siblings for the clicked element in jQuery: $(document).ready(function(){   $(".target").click(function(){      $(this).parent().siblings().removeClass("selectedClass");      $(this).parent().addClass("selectedClass");   }); });   a {       cursor:pointer;     }   .selectedClass{       color:blue;     } Countries     India     US     UK

Read More

How to extract the last n characters from a string using Java?

Vikyath Ram
Vikyath Ram
Updated on 11-Mar-2026 12K+ Views

To extract last n characters, simply print (length-n)th character to nth character using the charAt() method.Examplepublic class ExtractingCharactersFromStrings {    public static void main(String args[]) {           String str = "Hi welcome to tutorialspoint";       int n = 5;       int initial = str.length()-5;       for(int i=initial; i

Read More

How to create a string from a Java Array?

Arushi
Arushi
Updated on 11-Mar-2026 462 Views

You can convert an array of Strings to a single array using the collect() method.Exampleimport java.util.Arrays; import java.util.stream.Collectors; public class CreatngStringFromArray {    public static void main(String args[]) {       String [] myArray = {"Welcome", "to", "Tutorialspoint"};       String str = Arrays.stream(myArray).collect(Collectors.joining(" "));       System.out.println(str);    } }OutputWelcome to Tutorialspoint

Read More

How to define multiple CSS attributes in jQuery?

Alex Onsman
Alex Onsman
Updated on 11-Mar-2026 2K+ Views

To define multiple CSS attributes in jQuery, use the css selector or the addClass() method. Let’s see how to do it using css selector.Pair up strings representing property names with the corresponding values.ExampleYou can try to run the following code to learn how to define multiple CSS attributes in jQuery: $(document).ready(function(){ $("#demo").css({     "background-color": "#F1F1F1",     "font-style"     : "italic" });     }); Countries

Read More

What are label statements in JavaScript?

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 4K+ Views

JavaScript label statements are used to prefix a label to an identifier. A label can be used with break and continue statement to control the flow more precisely. A label is simply an identifier followed by a colon (:) that is applied to a statement or a block of code. We will see two different examples to understand how to use labels with break and continue.ExampleYou can try to run the following code to use labels to control the flow, with break statement                    document.write("Entering the loop! ");     ...

Read More

How jQuery selects elements using CSS?

Alex Onsman
Alex Onsman
Updated on 11-Mar-2026 551 Views

jQuery uses CSS selector to select elements using CSS. Let us see an example to return a style property on the first matched element. The css( name ) method returns a style property on the first matched element.Here is the description of all parameter used by this method −name − The name of the property to access.ExampleYou can try to run the following code to learn how jQuery selects elements with CSS:           jQuery Example                              $(document).ready(function() {       ...

Read More

How to set width and height of an element using jQuery?

Alex Onsman
Alex Onsman
Updated on 11-Mar-2026 4K+ Views

To set the width and height of an element using jQuery, use the width() and height() in jQuery.Width of an elementExampleYou can try to run the following code to learn how to set the width of an element in jQuery: $(document).ready(function(){     $("#button1").click(function(){         $("div").width(300);     });     $("#button2").click(function(){         $("div").width(400);     }); }); Width of div: 300 Width of div: 400 Height of an elementExampleYou can try to run the following code to learn how to set the height ...

Read More

What is the difference between append() and appendTo() in jQuery?

Alex Onsman
Alex Onsman
Updated on 11-Mar-2026 3K+ Views

The append (content) method appends content to the inside of every matched element, whereas the appendTo (selector) method appends all of the matched elements to another, specified, set of elements.jQuery append() functionThe append (content) method appends content to the inside of every matched element.Here is the description of all the parameters used by this method −content − Content to insert after each target. This could be HTML or Text contentExampleYou can try to run the following code to learn how to work with append() function in jQuery:           jQuery append() method         ...

Read More

What is the difference between height and line-height?

Alex Onsman
Alex Onsman
Updated on 11-Mar-2026 3K+ Views

Height is the vertical measurement of the container, for example, height of a div.Line-height is a CSS property to specify the line height i.e. the distance from the top of the first line of text to the top of the second. It is the space between the lines of two paragraphs.ExampleYou can try to run the following code to learn the difference between height and line height:                    .height {             height: 20px;          }          .lheight { ...

Read More

What is the difference between height and outerHeight in jQuery?

Alex Onsman
Alex Onsman
Updated on 11-Mar-2026 2K+ Views

height in jQueryThe height() is the vertical measurement of the container, for example, height of a div. It excludes the padding border and margin.To get the height of an element in jQuery, use the height() method in jQuery.ExampleYou can try to run the following code to get the height: $(document).ready(function(){     $("button").click(function(){         alert("Height of div element: " + $("div").height());     }); }); Get Height of div outerHeight() in jQueryThe outerHeight() returns the outer height of the first matched element. It includes padding and ...

Read More
Showing 301–310 of 61,248 articles
« Prev 1 29 30 31 32 33 6125 Next »
Advertisements