我怎麼會變成這個按鈕:將一個按鈕變成一個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