Hi there
My buttons on app stopped working. It is a new app. can you have a look at it?
Hi there
My buttons on app stopped working. It is a new app. can you have a look at it?
Hi Johnny,
Are there any console errors (F12)?
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!");
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!");
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!");
Found my error sorry!!
Needed a " ' " on the end
Johnny,
Glad you have it working!