Could you tell me how to connect elements of JavaScript?

Asked 1 years ago, Updated 1 years ago, 31 views

Nice to meet you, I'm trying to memorize js, but I'm stumbling on how to connect elements.
Below is an error.Could someone tell me how to connect it?Thank you for your cooperation.

■What you want to do
You want to pour csv into html or use jquery.csv.js (library) to place an array of csv in the new style.js.

■Completed html shape

<a href="test01.html"><img src="test01.jpg" alt="test02"/>

■ I don't know how to connect the alt= of the

for(vari=1;i<csvList.length;i++){
insert+='<a href="'+csvList[i][1]+'>img src="'+csvList[i][1]+'"/>";

■ CSV Example
test01[1]
test02[2]

When I tried connecting with +, I got an error.
I don't really understand js... Could someone please let me know?
Thank you for your cooperation.

javascript

2022-09-30 20:34

1 Answers

If you also want to specify alt, I think you just need to connect it as below.
Did you initialize insert?

Input:

test01.html test01.jpg test02

expression:

insert+=('<a href="'+csvList[i][0]+'>img src="'+csvList[i][1]+'+'+csvList[i][2]+'+'>/a>');


2022-09-30 20:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.