Posts

Showing posts with the label JavaScript

JavaScript Input Field Validation Function with Input field color highlight and Error Message Display

Image
  We use a lot of Forms regularly. If you are using a Form in your website, have you ever tried to create some validations on the form so that the inputs made by user can be checked? There are a lot of libraries out there which can help you do the input validation using JavaScript, but that is additional code that needs to be included, and third party libraries can often slow down your page load speeds.  Today, we'll write a small JavaScript function that we can include in our website and which does the input validation very quickly and efficiently. This function also highlights the input field in a color of your choice, and you can display an error message to your end user. If you have a form with multiple fields, and want to run validations on all of them, you'll have to loop through the fields one by one using a for loop, and run the validation on each one.  You can pass the field ID to the function and run the validation on it.  Below is our function which will d...

What is my IP Address - How to find your IP address on Local Network using Command Prompt, and External Network using JavaScript Code

Image
  IP Address or Internet Protocol Address, is a set of numeric (IPv4) or Alphanumeric (IPv6) characters, which uniquely identify a system on the internet. As per wikipedia: An Internet Protocol address is a numerical label such as 172.16.254.1 that is connected to a computer network that uses the Internet Protocol for communication. An IP address serves two main functions: host or network interface identification and location addressing.   Wikipedia So, the next question is, what is my IP address? Now, there are two kinds of IP address, Internal IP - which identifies your machine on an internal network such as your home network connected to a router, and External IP, which identifies the network on the WWW i.e. the world wide web.  Let's try to find our IP address! To find your Internal IP address, you just need to know a few basic commands.  Open the Command Prompt on a Windows machine, press Windows + R: Click on OK. Now, simply type the command - ipconfig This sim...

Reduce Server Load from Dynamic Page Search - Create a Dynamic JavaScript based Table filter

Image
  When we are building a website, and need to create a searchable list of web pages, performance is one of the key concerns. Frequent searches can put unnecessary load on the server. In this case, there is a cool alternate approach where you load the search page only once, and the search itself is done using Javascript! What is needed for this implementation? Not much, and we'll walk you through it! We will also have the flexibility to Search on different columns of a table.  First, let's create a table.  < table id = " list_table " style = " border-collapse: separate; border-spacing: 10px; " > < tbody > < tr > < th style = " text-align: left; " > SNo < / th > < th style = " text-align: left; " > Tool Name < / th > < th style = " text-align: left; " > Type Tags < / th > < / tr > < tr > < td s...

Calculate Your CTC Salary Hike Percentage - Online Calculator to find your New Salary

Image
  Did you receive a Salary Hike? Congratulations!  Using this CTC Hike Percentage calculator you can calculate: Percentage Hike Received New Expected Salary Old Salary (yes, you already know it! But if you want to compare, we've included that feature as well!) Receiving a Salary Hike is a really happy occasion. It means that your work is valued in your organization and the organization is willing to invest in you and your career growth. But as any human being, you are interested in exactly how much you have received. Most organizations provide either a lump sum amount in the hike letter or mention a percentage. Employees are left wondering that if I have received a certain amount of hike, what exactly is the percentage when compared to my old or previous salary. In the same way, if percentage is mentioned, then the employee is left wondering what will be my new salary.  So, we have a very simple solution for y...

Find Roots and Logs - Instant Number Operations using JavaScript

Image
  Let's start with a working Tool first. You can enter a Value in the Number Field for instant calculation of the Square, Cube, Square Root, Cube Root, Log, Log2 and Log10 of the Number. All in one Calculation! If you have noticed, as soon as you start writing a number in the Input field, the values start calculating. How does that Happen? Its the magic of JavaScript! Try out the Tool below: Number     Square Cube Square Root Cube Root Log Log 2 Log 10 Now, do you want to create a tool like this of your own? Great! We've utilized very simple mathematical functions supported by JavaScript and a custom function to call th...

Converter Tools - Convert Weight, Length, Temperature and Speed

Image
Converter tools are here to help you with instant conversion in different metric units. Just enter values against a Unit and all other are calculated. Weight Converter Type a Number value in any of the below fields for instant Weight Conversion: Measurement Value Pounds Kilograms Ounces Grams Stones Length Converter Type a Number value in any of the below fields for instant Length Conversion: Measurement Value Feet Meters Inches ...

How to tell your website visitors that they don't have JavaScript Enabled

Image
  This is not going to be a long post. In today's web-world, JavaScript is really important for websites. It is used for display, logic, data fetch and display, and page manipulations. So, of your end user is not having JavaScript enabled on his browser, the experience is not going to be the way you wanted it to be! So, how do we tell the user that JavaScript is not enabled on his browser, and maybe a small tutorial to enable it as well? We have a specific tag for it in HTML! We'll make use of the tag, and give our end user a simple message. You can change it the way you want. Also, we'll give him a link to the tutorial to enable JavaScript.  So, here's the simple code snippet you can put in your HTML: < noscript > For full functionality of this site it is necessary to enable JavaScript. Here are the < a href = " https://www.enable-javascript.com/ " target = " _blank " rel = " noopener noreferrer " > instructions how ...