嗨,我收到以下错误:
05-31 11:17:20.427: D/CordovaLog(20889): Uncaught ReferenceError: hello is not defined
在我的html上我已经嵌入以下内容将toggleswitch元素传递给我的javascript函数
<select name="toggleswitch1" id="toggleswitch1" data-theme="" data-role="slider"
data-mini="true" onchange="hello(document.getElementById('toggleswitch1'))">
这是我的javascript
<script>
function hello(toggle)
{
var e = toggle;
var value = e.options[e.selectedIndex].value;
if value == "yes"
{
//do something
}
}
</script>
我错过了什么?
答案 0 :(得分:3)
您的脚本中有错误:
<script>
function hello(toggle)
{
var e = toggle;
var value = e.options[e.selectedIndex].value;
if (value == "yes")
{
//do something
}
}
</script>
答案 1 :(得分:1)