Get query string parameters values from URL in JavaScript

Sometimes we need to retrieve URL parameters values from browser address bar in our client side script to process some functioning like click to a button or show/hide some elements. Here I have created a function in JavaScript to get query string parameters from URL and displayed uses example.

Read More

escaping special characters in jQuery selector

jQuery is a very powerful javascript library that We use all the time. It’s simple to use, yet easy enough to do very advanced things. Anyone who has used jQuery knows that you can do quite a lot with selectors. One of the caveats that I found is using a selector for a DOM element that contains special characters.

Read More

Getting all element values using jQuery

Many times we face the problem of getting all the form controls or elements values of a long form. Because sometime getting so many controls by their id or name is very typical that make a long list.
So we need to opt a short way for getting all element values using jQuery. I have described three ways in this article.

Read More

3 functions to check if string contains specific words

check for existence of a substring into a string is a common requirement for programmers. Here I’m describing 3 functions to check if string contains specific words.
  • strpos – Find the position of the first occurrence of a substring in a string.
  • strstr – Find the first occurrence of a string
  • preg_match – Perform a regular expression match

Read More

JavaScript String substr() Method

The substr() method returns the characters in a string beginning at the specified location through the specified number of characters. Syntax, parameters, examples of substr() in Javascript are as below.

Read More

JavaScript String substring() Method

substring() is one of the main string function which is mostly used in javascript. The substring() method extracts the characters from a string, between two specified indices, and returns the new sub string.

Read More

Getting query string values in javascript

Sometimes we get the important data through query string but question is of getting query string values in javascript or jquery because we need these values at client side. Even we can do it by using only javascript also.

Read More

check a substring into a string

Sometimes we need to check the existence of a character or sub-string into a string or find the position of a character or sub-string into a string. Javascript provide us a very simple method :

Read More

finding values in comma separated string using mysql

Generally, We give the various options of choices to choose on websites in form of checkbox and stores various values of choices in a column of MySQL database as a comma seperated . For example we store user’s preferred hobby in user table’s hobbies(varchar(250)) field(column). Value stored in this field may be like 1,2,5,6,1 or may be ‘sports’,’gardening’,’cooking’,’reading’.

Read More