How can I start with <a href=" and have an array element here then end with </a>?

Posted by Noor on Stack Overflow See other posts from Stack Overflow or by Noor
Published on 2010-04-21T22:13:35Z Indexed on 2010/04/21 22:23 UTC
Read the original article Hit count: 89

Filed under:
|
|
|

The thing im trying to do right now is pulling in multiple links from a textarea,

We can pretend that a user inputs c:\pics\img01.jpg and in the next row he'll have the next imglink.

I want to pull those links, I allready have the code for that:

var entered = $('#filedir').val();  
var lines = entered.split(/\r\n/);  
var opttext = "";  
for(var i=0;i<lines.length;i++) {  
    opttext += '< img src="' + lines[i] + '">< /img>';
}
?

the problem is in the output which is:

< img src="file:///C:/pics/img01.jpgc:/pics/img02.jpg">< /img>

There should be two < img> elements..

Where am I going wrong? I've been at it for a bit over 2 hours now..

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about img