我有字符串:如何用HTML標籤替換字符串中的文本?
" Text01 [1] text02 [2] text03 [3] "
,我需要更換[1] [2] [3]
與input type="text"
我需要它來創建一個的JavaScript填充式的毛坯測驗。
我做了這樣的事情:
$("span").click(function()
{
var input = $("<input>", { val: $(this).text(), type: "text" });
$(this).replaceWith(input);
input.select();
});
我必須[1] [2] [3]
和之間添加一些標記的是,我不知道如何做的jQuery的一部分。
那麼,你有什麼嘗試? – putvande