Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
alerts ons-switch giving undefined
-
Every time when i click the button i am getting checked as undefined…
<ons-list modifier="inset" class="settings-list"> <ons-list-item > <span class="trn" data-trn-key="enabled_push_notification">Restaurant ON/OFF</span> <ons-switch var="s" modifier="list-item" onclick ="checking();" ></ons-switch> </ons-list-item> </ons-list>
My javascript function
function checking(){ alert("checking........+1"+document.getElementById("s").checked); }
-
That’s probably because you have
var="s"
instead ofid="s"
. But there should have been an error in the console first, right?