javascript
- 15 January
Generate Random Number Between 1 and 10 in JavaScript
1. Introduction In JavaScript, generating random numbers is a common task in various applications, such as games, simulations, or as part of algorithms. Our goal is to learn how to generate a random number between 1 and 10, which can be quite handy in many scenarios. The expected output in each case is a single […]
- 08 December
Escape quotes in Javascript
In this article, we will see how to escape quotes in Javascript. Let’s see what happens if we have singe quote in String and we also use single quotes to declare the string in javascript. [crayon-672a3aeb2c34a985630455/] Output: unknown: Unexpected token (1:26) Ways to escape quotes in Javascript There are multiple ways to escape quotes in […]
- 06 December
How to Capitalize first letter in Javascript
In this tutorial, we will see how to Capitalize first letter in Javascript. Capitalize first letter of String in Javascript There are multiple ways to Capitalize first letter of String in Javascript. Let’s go through each of them. Using charAt(), toUpperCase() and slice() We will combination of charAt(), toUpperCase() and slice() functions to capitalize first […]
- 05 December
Add character to String in Javascript
In this post, we will see how to add character to String in Javascript. There are multiple ways to add character to String in Javascript. Let’s go through them one by one. Add character to String at start of String in Javascript Using + operator You can simply use + operator to add character to […]
- 08 September
jQuery html() method example
In this post, Â we are going to see jQuery html method. html method is used to get html content of first matched elements, Â other elements will be ignored and html(‘new html content’) is used to set html content for all matched elements. Syntax for html() : [crayon-672a3aeb2c9a1761484235/] Syntax for html(‘new html content’) : [crayon-672a3aeb2c9a8570976795/] Let’s […]
- 28 August
jQuery text() method example
In this post, Â we are going to see jQuery text method example. text method is used to get text of all matched elements and text(‘new text’) is used to set text for all matched elements. Syntax for text() : [crayon-672a3aeb2cb78077115787/] Syntax for text(‘new text’) : [crayon-672a3aeb2cb7f681482189/] Let’s understand with the help of example: [crayon-672a3aeb2cb81152938660/] Live […]
- 27 August
jQuery prepend and prependTo example
In this post, Â we are going to see jQuery prepend and prependTo methods. Both do the same task, insert text or html before content of every selected elements, so it will put text or html to first index of selected element. Both methods add text or html as a child to selected elements .Syntax is […]
- 25 August
jQuery before() and insertBefore() example
In this post, Â we are going to see jQuery before and insertBefore methods. Both do the same task, insert text or html before every selected elements but syntax is quite different. Syntax for after(): [crayon-672a3aeb2e1ba342516206/] inserting using after [crayon-672a3aeb2e1c9840420705/] Syntax for insertBefore() : [crayon-672a3aeb2e1cc745904254/] inserting using insertBefore [crayon-672a3aeb2e1ce088102089/] Let’s understand with the help of example: […]
- 24 August
jQuery append and append to example
In this post, Â we are going to see jQuery append and appendTo methods. Both do the same task, insert text or html after content of every selected elements, so it will put text or html to last index of selected element. Both methods add text or html as a child to selected elements .Syntax is […]