如何用ipad中的div包装所选文本? [英] How to wrap selected text with a div in ipad?

查看:139
本文介绍了如何用ipad中的div包装所选文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个。我正在尝试使用 window.getSelection()将所选文本包装在div中a>但它无法在iPad中工作,因为window.getSelection()。rangeCount为0.

Its a followup question of this. I'm trying to wrap the selected text in a div using window.getSelection() but its not working in iPad because window.getSelection().rangeCount is 0.

演示: http://jsfiddle.net/codef0rmer/jE4w5/

是否有任何解决方法可以使用在iPad?

Is there any workaround for this to work in iPad?

推荐答案

您可以使用 rangy 用于文本选择和突出显示。 jQuery Mobile和backbone.js打破了页面,因此我使用了 jQuery FastClick 插件

You can use rangy for text selection and highlighting. jQuery Mobile along with backbone.js breaks the page so I used jQuery FastClick plugin

这篇关于如何用ipad中的div包装所选文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆