0
Good afternoon, I have a mobile application written in Mobileui and JS, where I have an Alert for the company exchange function. In this Alert has radio inputs, which is to select only one of the options. I wish when opening Alert it always came with the selected input marked, but it always brings me blank.
Could you help me? Follow below code.
Javascript file
var empresaSelect
function trocarEmpresa(){
map.setClickable(false)
alert({
id: 'alertEmpresa',
title: 'Trocar Empresa',
message: 'Realize a troca de empresa!',
template: 'empresaVendedor',
width: '60%',
buttons:[
{
label: 'OK',
onclick: function() {
closeAlert('alertEmpresa')
map.setClickable(true)
findFormVendedor()
myLocation()
}
},
{
label: 'Cancelar',
onclick: function() {
closeAlert('alertEmpresa')
map.setClickable(true)
}
}
]
})
}
function selectedEmpresa(index) {
empresaSelect = empresas.filter(function (e, i) {
return i == index ? e : null
})
empresaSelect = empresaSelect[0]
}
document.addEventListener('backPage', function() {
closeAlert('alertEmpresa')
})
HTML file
<div class="hidden" id="empresaVendedor">
<div class="list">
<div class="item" data="empresas">
<h2>${razaoSocial}</h2>
<div class="right">
<input name="radio-emp" type="radio" class="teal" onclick="selectedEmpresa($$index)">
</div>
</div>
</div>
</div>
Have you tried setting the input state to
checked
straight into the html tag? Like this:<input checked name="radio-emp" type="radio" class="teal" onclick="selectedEmpresa($$index)">
?– hugocsl