Sometimes we need to get values through the query string in the URL on the browser address bar. But the question is how to get these query string values in JavaScript or jquery because we need them on the client-side.
Tag » String
Display Custom Post Types Content in WordPress Templates
Create few templates to display custom post types content in WordPress. In the previous article, we have created few posts in our Books post types with some custom content fields.
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.
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.
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.
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
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.
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.
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.
find last position of a substring into a string
Sometimes we need to find last position of a substring into a string. Substring may be a character or a part of a string. Javascript provide us a method