0
我不知道如何获得div contenteditable中的第一个链接(文本类型)。在我的事业部,我的价值是:获取Div中contenteditable的第一个链接用Javascript
<div id="content" contenteditable="true" value="http://google.com and other string but i only get the link"></div>
而第二个问题,当值http://google.com http://yahoo.com
我想只得到第一个链接http://google.com
。
我使用jQuery与key contenteditable中的关键事件。希望你能帮助我,谢谢!
更新我的代码:
$(document).ready(function()
{
$("#content").keyup(function(){
var link = $("content").text();
console.log(link);
});
}
和HTML
<div id="content" contenteditable="true"></div>
你可以在Jsfiddle中做一个演示,它会更详细地描述它。 – Manwal
显然你有一些代码,请显示它的相关部分。 – Teemu
是的,对不起,我会更新我的问题 –