IE bug: Object doesn't support this action for "item"

As a web developer we have to write codes supported by maximum or all browsers.A few people love Internet Explorer,and our clients do not wan to skip ie users. Although there are many reason to hate the ie .but this strange reason added o my dictionary today :  Object doesn’t support this action.

I was testing a shopify site and in pre-installed theme there was a JavaScript function that add items in cart the word “item” causing this error of Object doesn’t support this action.
this function works well in other browser like Firefox and chrome but in Internet explorer it fails.after testing it by developer console of internet explorer I got this

ie_object

after a long search I found that item is reserved keyword for internet explorer, whether you are using internet explorer 8 ,ie 9 or ie 10 in any of your os xp vista ,window 7 or window8.
it is reserved keyword.you can’t use item as javascript variable.

so the possible solution of this is to remove all javascript variable item with some other like itemx or cart item

item is reserved keyword for internet explorer you can find the proof in this blog post

so next time you stuck with Object doesn’t support this action thing then check whether it is reserved keyword or not.

preview form before submit jquery plugin

preview form before submit is a common idea. idea of making such a plugin comes in my mind when i was working on a cake project and client ask me to do it.developer needs such a plugin most of the time and don’t like to write the same code in php js or jquery again and again.

preview before submit

What is it ?

previewForm is a tool for displaying form content before it goes to the server for processing.This plugin provides users to confirm the data before they are going to sumit it.
It was built using the jQuery library. Licensed under both MIT and GPL licenses

Demo

Feature

  • Preview the value of textbox.
  • Preview the value of selectbox.
  • Preview the value of radiobox and checkbox.
  • Preview password field if option selected.

Example

Example 1 With password preview.

Example 2 with password disable.

How to Use

 

1. First, make sure you are using valid DOCTYPE and correct form structure.

Your form must contain for tag of label with corresponding id of the field.
sample is
clip_image002

2. Include jQuery and previewForm JS files.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10/jquery.min.js"></script>

<script type="text/javascript" src=”previewForm / previewForm.js"></script>

 

3. Add previewForm CSS file

4. Fire plugin using jQuery selector

<script type="text/javascript">
$(document).ready(function() {
	$('#myform').previewForm({ show_password : false });
});
</script>

 

API & Options

Key Default value Description
show_password true Whether you want to show the password field in preview
extratext ‘Do You Want To submit’ Extra text before confirmation buttons
yes yes Button Label for yes button
no no Button Label for no button
title Please preview Title of preview dialog

Demo

Download

Notepad ++ crash !! Recover your lost file

What if your notepad++ crash while you are uploading  your file with ftp, and after restart notepad++ you see the file is empty!!!!!!!! I am sure it will make you crazy.This thing happens with me many time. Luckily we have solution if this thing happens to you gain. You can recover your file and its content.

Step 1. When Notepad++ crash

You are uploading file crashes.php, suddenly following screen appears on your window
source code editor has stopped working. i.e notepad ++ crash !!!
notepad++ crashes then recover file

Then do not close the notepad++.

Step 2. Locate the file in Notepad++ Cache

Here is simple shortcut to locate the local copy of the file.
Press WinKey+R . Now in run textbox enter the path below.

%AppData%/Notepad++/plugins/config/NppFTP/Cache

source code editor has stopped working

Notepad++ stores the cache data in roaming directory of system.

Step 3.Create backup of the cache file

Now in Cache directory all your edited ftp files present as in live server .
Locate and copy the file crashes.php for backup copy the file on desktop . Rename it to backup_crashes.php .
After creating backup ,you can restart your Notepad++ (GNU) .

 

Step 4. Recover the file.

Restart Notepad++
connect with your remote server
open the remote file crashes.php again .
if it is blank then copy the content from local backup file(backup_crashes.php) stored on desktop.

So  next time if notepad crashes while uploading then keep these steps in mind.

google maps from address with jquery

One of my client need this feature of google maps from address so he must be able to enter the address in its admin panel and he want to show it as google map on front end.So i made this option for him and new post for my blog.you can use this code with any language like php c# java etc or any framework.googlemap by address

Google maps from address with jquery and map api

The idea behind google map from address is simple.It is based on reverse geocoding google map.I am using google map v3 api.

Lets get right to the topic

we will use google map api
https://maps.googleapis.com/maps/api/js?sensor=false
and jquery
https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js

To get map from google you need location’s longitude latitude
you can get location geocode from google map Geocoder function.

How google maps from address works

google map latitude longitude

Stage 1 : Your Address goes to geocoder.
address includes address, city/town , State, postalcode and country.
Function : google.maps.Geocoder();

Stage 2 : Geocoder fetch your address’s latitude and longitude.

Stage 3: These latitude and longitude value passed to the google map function.
Function : google.maps.Map();

Stage 4: The google map then represent these latitude and longitude value in map.
you can design your info window of address here by
Function : google.maps.InfoWindow()

Also you can set the title of your location by marker function.
Function : google.maps.Marker()

Feature of google maps from address widget

  • You can select from all the four view of google map.
    ROADMAP displays the normal, default 2D tiles of Google Maps.
    SATELLITE displays photographic tiles.
    HYBRID displays a mix of photographic tiles and a tile layer for prominent features.
    TERRAIN displays physical relief tiles for displaying elevation and water features.
  • You can set the zoom level of the map.
  • You can get longitude latitude from google maps address(can find geocode).
  • Find location by latitude longitude google map.

Download section

Live Demo Download Source