How can I change the data-icon depending of the network
Dear All,
In my Application, I am testing the network. If the GPS if active, I want to have the check icon and if not I want to have the delete icon. I craeted that function. I do not understand why the icon is not change depending of the connection. The text() works (see teh commented code) but the icon does not change.
I tried with button('refrresh') and I also tried with trigger('create'). But in both case, the icon is not changed.
What suggest you to me ?
Cheers
- function network(status){
//document.addEventListener("deviceready", function(){
if(status==1){
$(".network_status").attr("data-icon", "check").trigger('create');
}else{
$(".network_status").attr("data-icon", "delete").trigger('create');
}
-
/*
if(navigator.connection.type != Connection.NONE){
$(".network_status").text('No Internet ')
.attr("data-icon", "delete")
.button('refresh');
}else{
$(".network_status").text('Internet ')
.attr("data-icon", "check")
.button('refresh');
}
*/
//});
}