Turn Each Line Of Textarea Into A Link
Let's say for example i have a textarea and a toggle button:
Solution 1:
You cannot make clickable links inside textarea, they are for a plain text.
There are possible workarounds though, you can make a div, copy formatted content of textarea to this div, when "Toggle" is clicked, and switch textarea and div.
Solution 2:
Your each
function takes index and value parameters that you can use to make your anchors
$.each(links, function (i, val) {
var newA = $("<a />").text(val).attr("href", $.trim(val));
$("#links").append(newA).append("<br>");
});
(Though obviously you'll have to add them to a div, as the fiddle does. As anrie says, textareas can only hold text.)
Post a Comment for "Turn Each Line Of Textarea Into A Link"