Johnny
Posts: 0
Joined: Tue Jul 23, 2013 10:09 am

Buttons not working

Hi there

My buttons on app stopped working. It is a new app. can you have a look at it?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Buttons not working

Hi Johnny,

Are there any console errors (F12)?

Johnny
Posts: 0
Joined: Tue Jul 23, 2013 10:09 am

Buttons not working

Yes, with my second if... but don't know what is wrong
if (localStorage.getitem('nom1').val() != ' ') {
var nom1 = localStorage.getItem('nom1');
var smssave = localStorage.getItem('smssave');
window.location.href='sms:'+nom1.val()+'?body='+smssave.val()+';
}
if (localStorage.getitem('nom2').val() != ' ') {
var nom2 = localStorage.getItem('nom2');
var smssave = localStorage.getItem('smssave');
window.location.href='sms:'+nom2.val()+'?body='+smssave.val()+';
}
if (localStorage.getitem('nom3').val() != ' ') {
var nom3 = localStorage.getItem('nom3');
var smssave = localStorage.getItem('smssave');
window.location.href='sms:'+nom3.val()+'?body='+smssave.val()+';
}
if (localStorage.getitem('nom4').val() != ' ') {
var nom4 = localStorage.getItem('nom4');
var smssave = localStorage.getItem('smssave');
window.location.href='sms:'+nom4.val()+'?body='+smssave.val()+';
}
alert("Send!");

Johnny
Posts: 0
Joined: Tue Jul 23, 2013 10:09 am

Buttons not working

Changed it to (see below) . But still problem

Code: Select all

 var smssave = localStorage.getItem('smssave'); 

if (localStorage.getitem('nom1') != ' ') {
var nom1 = localStorage.getItem('nom1');
window.location.href='sms:'+nom1.val()+'?body='+smssave.val()+';
}
if (localStorage.getitem('nom2') != ' ') {
var nom2 = localStorage.getItem('nom2');
window.location.href='sms:'+nom2.val()+'?body='+smssave.val()+';
}
if (localStorage.getitem('nom3') != ' ') {
var nom3 = localStorage.getItem('nom3');
window.location.href='sms:'+nom3.val()+'?body='+smssave.val()+';
}
if (localStorage.getitem('nom4') != ' ') {
var nom4 = localStorage.getItem('nom4');
window.location.href='sms:'+nom4.val()+'?body='+smssave.val()+';
}
alert("Send!");

Johnny
Posts: 0
Joined: Tue Jul 23, 2013 10:09 am

Buttons not working

Made the code easier to read:

var smssave = localStorage.getItem('smssave');
var nomm1 = localStorage.getItem('nom1');
var nomm2 = localStorage.getItem('nom2');
var nomm3 = localStorage.getItem('nom3');
var nomm4 = localStorage.getItem('nom4');

if (nomm1.val() != ' ') {
window.location.href='sms:'+nomm1.val()+'?body='+smssave.val()+';
}
if (nomm2.val() != ' ') {
window.location.href='sms:'+nomm2.val()+'?body='+smssave.val()+';
}
if (nomm3.val() != ' ') {
window.location.href='sms:'+nomm3.val()+'?body='+smssave.val()+';
}
if (nomm4.val() != ' ') {
window.location.href='sms:'+nomm4.val()+'?body='+smssave.val()+';
}
alert("Send!");

Johnny
Posts: 0
Joined: Tue Jul 23, 2013 10:09 am

Buttons not working

Found my error :) sorry!!

Needed a " ' " on the end

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Buttons not working

Johnny,

Glad you have it working!

Return to “Issues”