我怎么会变成这个按钮:将一个按钮变成一个jQuery UI图标?
<%= button_to "+1", video_votes_path(:video_id => video.id, :type => "up"), :remote => true %>
成jQuery用户界面提供的图标?
我尝试添加类的吧:
<%= button_to "+1", video_votes_path(:video_id => video.id, :type => "up"), :class => 'ui-icon-triangle-1-n', :remote => true %>
,但是这创造了一个怪异的按钮仍然有“+1”它里面。
我把这个代码在我的application.js文件:
$('input:submit, input:reset').each(function(){
$(this).replaceWith('<button type="' + $(this).attr('type') + '">' + $(this).val() + '</button>');
});
$('button:submit').button({
icons: {
secondary: 'ui-icon-triangle-1-n'
}
});
带有URL的图标?或者只是一个图标? – JohnP 2011-03-20 05:31:26
只是从jQuery UI的图标 – 2011-03-20 05:31:59
我假设你还想将按钮上的任何触发器转换为图像?不知道RoR,但为什么不看看生成的HTML并用JQ抓取? – JohnP 2011-03-20 05:33:40