Radio button flag

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 you have the radio inputs, which is to select only one of the options. I would like that when opening the alert it always came with the selected input marked, but it always goes blank.

Could you help me? Follow the code below.

JavaScriptFile

varempresaSelectfunctiontrocarEmpresa(){map.setClickable(false)alert({id:'alertEmpresa',title:'TrocarEmpresa',message:'Realizeatrocadeempresa!',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)}}]})}functionselectedEmpresa(index){empresaSelect=empresas.filter(function(e,i){returni==index?e:null})empresaSelect=empresaSelect[0]}document.addEventListener('backPage',function(){closeAlert('alertEmpresa')})

HTMLfile

<divclass="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>
    
asked by anonymous 05.10.2018 / 18:57

1 answer

0

Well it's something easy to solve, use the "Checked" property of the input (HTML) In your code:

    <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)" checked >
                </div>
            </div>
        </div>
    </div>

Reference: link

    
06.10.2018 / 19:36