javascript
- 08 February
Round to 2 decimal places in JavaScript
In this post, we will see how to round to 2 decimal places in javascript. Using Math.Round() to Round to 2 Decimal Places in JavaScript You can use Math.round() function to round number to 2 decimal places in javascript. You need to multiply number by 100, apply Math.round() and then divide by 100. [crayon-6273bc35f3c43105062286/] Output: […]
- 15 January
Generate random number between 1 and 10 in javascript
In this post, we will see how to generate random number between 1 to 10 in javascript. How to generate random number between 1 and 10 in javascript We can simply Math.random() method to generate random number between 1 and 10 in javascript. Math.random() returns a random number between 0(inclusive), and 1(exclusive). That means Math.random() […]
- 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 […]
- 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-6273bc3600668813578338/] Output: unknown: Unexpected token (1:26) Ways to escape quotes in Javascript There are multiple ways to escape quotes in […]
- 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-6273bc3600bbe477587004/] Syntax for html(‘new html content’) : [crayon-6273bc3600bc4339247266/] Let’s […]
- 22 August
How to check or uncheck checkbox input or radio button in jQuery
[crayon-6273bc3600e41574492985/] Live Demo: jQuery check/uncheck a check box example on jsbin.com
- 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-6273bc3600f89663586619/] Syntax for text(‘new text’) : [crayon-6273bc3600f8e044114623/] Let’s understand with the help of example: [crayon-6273bc3600f90595416964/] 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 […]