github preview feature with rails 3.2

北城余情 提交于 2019-12-01 11:04:40

Give the preview tab link an ID and use the show event of the tab to update the content. How you access the data to provide to tab content will depend on WYSIWYG you are using

$('#preview_tab').on('show',function(){
    var preview=$('#comment').val();
    preview= preview.length ? preview : 'No Comment provided'
    $('#preview_pane').html(preview)
});

DEMO: http://jsfiddle.net/hrXCC/

API Reference (see Events for tabs) : http://twitter.github.com/bootstrap/javascript.html#tabs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!