1

I have this select in Pug/Jade

select.form-select.col-xs-12.col-sm-12(id='selState1', onClick='+setState(selState1.value)')
                  option(value='selState1', name='selState1',id='selState1') Enter state
                  each state in nigeria.states()
                    option(value='state') #{state} 

Now I need to use the value of the selected option as a parameter in function nigeria.lgas() that generates the options for another select

I have done

 select.form-select.col-xs-12.col-sm-12(id='selLG1', name='selLG1')
                  option.active(value='selLG') Enter Local Government
                    each lg in nigeria.lgas(selState1.value)                      
                      option(value=lg) #{lg}

I get the error 'selState1 is not defined'

2
  • Have you tried to replace selState1.value with selLG1.value?
    – The KNVB
    Commented May 2 at 8:03
  • No that doesnt do it. nigeria.lgas() function uses the selected state from the first select as parameter.
    – Femi
    Commented May 2 at 9:07

0

Browse other questions tagged or ask your own question.