created the javascript to check whether it's working and added some functionality