javascript - How to set arrays values to ";" seperated value -


i have array have value this.

a = ["val1,val2","val3"]

so technically

a[0] = "val1,val2" a[1] = "val3"

when assiging tag ftag.setattribute('v', a);

here in case getting <tag v = val1,val2,val3 ></tag>

i wanted avoid therefore want seperate through ";"

it

<tag v = val1,val2;val3 ></tag>

so, how seperate array value through ";".

use javascript array join method

function myfunction() {      var = ["val1,val2","val3"];      document.getelementbyid("demo").innerhtml = a.join(";");        }
<button onclick="myfunction()">try it</button>    <p id="demo"></p>


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -