Category Archives: JavaScript

Turn on/off Autocomplete for Input

It just a input attributes. Use autocomplete=”off” attributes in input. <input name=”name” type=”text” autocomplete=”off” /> It useful when unique text input. Such as captch text, auto-suggest or autocomplete feature, credit card information or where you need one time user input. Using jQuery. jQuery(‘input’).attr(‘autocomplete’,’off’); or jQuery(‘input’).prop(‘autocomplete’,’off’); // prop is replaced attr method in current jquery version. […]

Get URL Parameters With JavaScript

In this example you can see how to get URL parameter in JavaScript. Using window.location object you can perform this task. window.location.search window.location.search returns a query string in JavaScript.  ?blog=sourcecodemart&artical=1789 Now remove “?” from the string. You can use substring() function to remove chars. window.location.search.substring(1); // blog=sourcecodemart&artical=1789 Now split query string into array using JavaScript […]

The Things you can do using window.location object

In today’s era JavaScript uses more n more in web apps. There are many things you can do with javascript like reload page, replace url, get useragent, url string, url address, etc… Here I am going to explain window.location object. It is more userful if you are playing with JavaScript. 1. window.location.hash location.hash is used […]

Redirect user to another page via jQuery or Javascript

There are several methods to redirect user to another page. Here I will explain snippet code of jQuery and JavaScript to redirect user from one to another web page. Location Object Using location object you can redirect user to another page. Copy below code and paste it in Firefox or Chrome console and see there […]

convert URL query string to object

As we discussed about how to convert object to query string. Here we are going for reverse engineering. i.e. convert query string to object. First of all thing about how to get url query sting through JavaScript? It’s pretty simple. Window.location.search; location.search gives us a query string which is located in url address. Guess our […]

How to check Dom element exists using jQuery?

Sometimes, we need to check is Dom element exists or not. If yes then process next step. It’s on JavaScript validation or before fire any trigger for rendering data through JavaScript. Generally, we have done mistake to check is HTML Dom element is alive or not using jQuery. For example, jQuery(‘#elementid’); Here jQuery always return […]

Remove duplicate elements from array?

Introduction In this article you can view a short tips about JavaScript which is very useful in your programming life. As I love jQuery.js so that first I explain how to remove duplicate element from Array using jQuery method. It is a single line of code. JavaScript Array: var arr1 = [‘Java’,’DotNet’,’PHP’,’Python’,’Ruby’,’Java’,’java’,’JavaScript’,’jQuery’]; Using jQuery: var […]

JavaScript List to Array and Array to List

Sometimes we don’t know about all functionality of any technology. So normally we have made whole logic for our requirement. The same case occurred with me and I want share with you. Actually, I wanted to convert my JavaScript Array into List. Just look below code that I have made before some days in order […]

CODING TIPS FOR PERFORMANCE IMPROVEMENT

In this post I cover most performance improvement tips related JavaScript, CSS and PHP. While working with small web application its OK to ignore these tips but whenever you are going to dealing with large web application which will have so many user base and may increase database day by day then you should have to take […]