Don’t Allow Special Characters in Textbox Javascript

Whenever we create a contact form or user form. We want that no user should input a special character, because there may be a hacking script. Which can destroy or hack our database or project file. In this blog post, we will learn how don’t allow special characters in textbox javascript. First, make a textarea … Read more

How to Add Two Variables in Javascript?

In this blog, we will learn how to add two variables in javascript. Generally, whenever we try to add two numbers in javascript using “+”, we get the result 2+2 = 22. while we expect 4. So first we have to tell javascript that we want to add integer types value. For this, we can … Read more

How to Draw Shapes with Javascript?

Through JavaScript, we can draw many shapes on the HTML canvas. We will draw many shapes in javascript in this blog post, so let’s start. Draw Rectangular Shapes in javascript HTML Javascript Result Draw Circle Shapes in javascript Html Javascript Result Draw a right-angled triangle in javascript Html Javascript Result Similarly, we can draw many … Read more

How to Align Text in Javascript?

We will learn in this blog post how a paragraph text can be aligned with the click of a button. We are going to use the Style textAlign property here. The text-align CSS property sets the horizontal alignment of the content inside a block-level element. This means it works like vertical-align but in the horizontal direction. CSS Demo: text-align “justify” … Read more

Query all columns (attributes) for every row in the CITY table.

Query all columns (attributes) for every row in the CITY table. Input FormatThe CITY table is described as follows: Ansewer Explanation The SELECT statement is used to retrieve records from one or more tables in your SQL database. If we want to retrieve all data, use * ( The asterisk or star symbol ( * ) means all columns).

Count Number of a Character in String In Javascript

In this blog post, we count the number of characters in string In javascript. Such if we a string like: “Hello, codemen. How are you?” In this string, we want to count the number of characters “y”. the result should be 1. Method 1 : Using Match The match() method retrieves the result of matching a string against a regular … Read more

Show Bootstrap Modal on Page Load

In this blog post, we learn, how to open or show bootstrap modal on page load. Generally, we need models to show some information or notice to visiter. There are many types of models are available in bootstrap. we can easily open all types of modal with a simple script. Here I am use  jQuery load event … Read more

How to Compare Two Arrays in Javascript

In this post, we compare two arrays, We have many simple ways to do this task in Javascript. #1: Get the difference between two arrays in JavaScript? To get the difference between two arrays we can use a Filter() function of javascript. The filter() the method creates a new array with all elements that pass the test implemented by … Read more

Check If Element Exists in Javascript

In this post, we check if a certain element exists in the DOM. We have many methods in Javascript to do this task. Method 1: document.querySelector() The Document method querySelector() returns the first Element within the document that matches the specified selector.  If no matches are found, null is returned. Method 2 : document.getElementById() Method getElementById() returns an Element an object representing the element whose id property matches … Read more