Javascript 在Rhomobile';s应用程序
我试图在Select上触发onChange事件,但未触发该事件 我的选择中有以下代码:Javascript 在Rhomobile';s应用程序,javascript,rhomobile,Javascript,Rhomobile,我试图在Select上触发onChange事件,但未触发该事件 我的选择中有以下代码: <select onchange="myEvent()" name="configuration[notifications_enabled]" id="configuration[notifications_enabled]" data-role="slider"> <option value="0" <%= "selected" if Integer(@configur
<select onchange="myEvent()" name="configuration[notifications_enabled]" id="configuration[notifications_enabled]" data-role="slider">
<option value="0" <%= "selected" if Integer(@configuration.notifications_enabled) == 0 %>>O</option>
<option value="1" <%= "selected" if Integer(@configuration.notifications_enabled) == 1 %>>|</option>
</select>
O
|
我的文件顶部有以下事件:
<script type="text/javascript">
function myEvent() {
<% app_info("inside the event") %>
}
</script>
函数myEvent(){
}
当我第一次进入视图时,消息显示在控制台上。但是
当我更改“选择”按钮时,它将不再打印
我尝试了onClick事件,但它也不起作用
我也尝试过:
<script>
$('#configuration[notifications_enabled]').change(function()
{
app_info('Value change to ' + $(this).attr('value'));
});
</script>
$(“#配置[已启用通知])。更改(函数()
{
app_info('值更改为'+$(this.attr('值'));
});
但什么也没发生,甚至连一条错误消息都没有
我做错了什么
我不确定我是否能在罗兹做到这一点,或者我是否应该以其他方式解决这个问题
谢谢最后通过拨打电话解决了问题:
<script type="text/javascript">
$('.watchable').live('change', function() {
<!-- process you data here or whatever -->
});
$('.watchable').live('change',function(){
});
其中我的select标记有一个名为watchable的类