我想写一个使用jQuery的功能文本()替换字符串我怎么用jQuery剥离HTML功能
想这里面的html函数内部:
function formatData(inputstring) {
// strip HTML
var output = $(inputstring).text();
// ... do some more stuff with output
return output ;
}
,然后用它就像
alert (formatData("some <b>html</b> stuff"))
为什么这不起作用?
什么是输入这里 – PSR
你怎么称呼呢?输入应该是一个有效的jQuery选择器。 – BigMike
输入应该是一个字符串 – rubo77