六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 56|回复: 0

给html element添加触发事件

[复制链接]

升级  41.33%

98

主题

98

主题

98

主题

举人

Rank: 3Rank: 3

积分
324
 楼主| 发表于 2013-2-7 14:57:00 | 显示全部楼层 |阅读模式
Rails 中给html element添加触发事件:

form_for要写到:html=>{}里面,
<% form_for(@track,:url => { :action => "create" } , :html => { :multipart => true , :onsubmit=>"$('#track_position_x')[0].value.replace(/,/g,',');$('#track_position_y')[0].value.replace(/,/g,',');"} ) do |f| %>

text_field要写到:html=>{}外面
<%=f.text_field :position_y,:onkeyup=>"this.value.replace(/,/g,',');"%>

DHH怎么这么写。。。。
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表