How to set nonstandard attribute in html using javascript











up vote
0
down vote

favorite












According to a book I read there are two ways to do it. Which are as follows:



First way



var insTag = document.body.getElementsByTagName('ins');
for(var i = 0;i < insTag.length; i++){
insTag[i].setAttribute('chord', 'value');
}


Second way



var insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'value');


And this is the code in the html file:



<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
</body
</html>


The ins tag has an attribute called 'chord' which I'd like to set through the JavaScript file.



The above code doesn't seem to be setting the attribute and I'm getting no errors.



If I manually set the attibute in the html file everything works as expected.



I'm a beginner in JavaScript and html, and very confused as to how to sort this one out.



Thanks in advance for any help towards the solution.










share|improve this question
























  • If you run the code as is, you'll see an error in your browser developer tools console - this should be your first debugging step every time - once fixed, your code will do as you wish
    – Bravo
    Nov 9 at 0:21















up vote
0
down vote

favorite












According to a book I read there are two ways to do it. Which are as follows:



First way



var insTag = document.body.getElementsByTagName('ins');
for(var i = 0;i < insTag.length; i++){
insTag[i].setAttribute('chord', 'value');
}


Second way



var insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'value');


And this is the code in the html file:



<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
</body
</html>


The ins tag has an attribute called 'chord' which I'd like to set through the JavaScript file.



The above code doesn't seem to be setting the attribute and I'm getting no errors.



If I manually set the attibute in the html file everything works as expected.



I'm a beginner in JavaScript and html, and very confused as to how to sort this one out.



Thanks in advance for any help towards the solution.










share|improve this question
























  • If you run the code as is, you'll see an error in your browser developer tools console - this should be your first debugging step every time - once fixed, your code will do as you wish
    – Bravo
    Nov 9 at 0:21













up vote
0
down vote

favorite









up vote
0
down vote

favorite











According to a book I read there are two ways to do it. Which are as follows:



First way



var insTag = document.body.getElementsByTagName('ins');
for(var i = 0;i < insTag.length; i++){
insTag[i].setAttribute('chord', 'value');
}


Second way



var insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'value');


And this is the code in the html file:



<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
</body
</html>


The ins tag has an attribute called 'chord' which I'd like to set through the JavaScript file.



The above code doesn't seem to be setting the attribute and I'm getting no errors.



If I manually set the attibute in the html file everything works as expected.



I'm a beginner in JavaScript and html, and very confused as to how to sort this one out.



Thanks in advance for any help towards the solution.










share|improve this question















According to a book I read there are two ways to do it. Which are as follows:



First way



var insTag = document.body.getElementsByTagName('ins');
for(var i = 0;i < insTag.length; i++){
insTag[i].setAttribute('chord', 'value');
}


Second way



var insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'value');


And this is the code in the html file:



<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
</body
</html>


The ins tag has an attribute called 'chord' which I'd like to set through the JavaScript file.



The above code doesn't seem to be setting the attribute and I'm getting no errors.



If I manually set the attibute in the html file everything works as expected.



I'm a beginner in JavaScript and html, and very confused as to how to sort this one out.



Thanks in advance for any help towards the solution.







javascript






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 14:38

























asked Nov 9 at 0:16









Ricardo de Paula Soares

115




115












  • If you run the code as is, you'll see an error in your browser developer tools console - this should be your first debugging step every time - once fixed, your code will do as you wish
    – Bravo
    Nov 9 at 0:21


















  • If you run the code as is, you'll see an error in your browser developer tools console - this should be your first debugging step every time - once fixed, your code will do as you wish
    – Bravo
    Nov 9 at 0:21
















If you run the code as is, you'll see an error in your browser developer tools console - this should be your first debugging step every time - once fixed, your code will do as you wish
– Bravo
Nov 9 at 0:21




If you run the code as is, you'll see an error in your browser developer tools console - this should be your first debugging step every time - once fixed, your code will do as you wish
– Bravo
Nov 9 at 0:21












3 Answers
3






active

oldest

votes

















up vote
0
down vote



accepted










Place the scripts after the ins tag. The document loads from top to bottom; the tag needs to exist first before a script can do anything with it.



In general practice, scripts should be placed at the very bottom, right before </body>.






<body>
<ins class='scales_chords_api'></ins>
...
<script>
const insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'b');
</script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>
</body>





In the snippet above I added the JS code directly in the HTML, but adding it in your index.js file is fine too. As long as you load that first, followed by the API.






share|improve this answer























  • Unfortunately it didn't work. I have actually tried your suggestion before, sorry for not mentioning it in the question. I think the reason why this approach is not working is because the api doesn't recognize the attribute 'data-chord'. It expects 'chord' instead. But this is just a thought that occured to me.
    – Ricardo de Paula Soares
    Nov 9 at 14:14










  • I figured it out, rewrote my answer completely with working code.
    – LionelW
    Nov 11 at 12:12


















up vote
0
down vote













Remove your scripts after dom. Because there was no element before your code ran



snap



[code in jsfiddle](http://jsfiddle.net/o4kujx8t/)





share|improve this answer























  • Could you please elaborate a bit more on your suggestion. Thank you.
    – Ricardo de Paula Soares
    Nov 9 at 14:07










  • Thanks for your efforts in trying to help. It worked.
    – Ricardo de Paula Soares
    Nov 13 at 3:01


















up vote
0
down vote













Am I missing something? It seems to be working for me.






var insTag = document.querySelector('ins');
insTag.setAttribute('chord', '4');

var insTagA = document.body.getElementsByTagName('insA');
for(var i = 0;i < insTagA.length; i++){
insTagA[i].setAttribute('chordA', 'value');
}


console.log(insTag.getAttribute('chord'));
console.log(insTagA[0].getAttribute('chordA'));

function myFunction() {
var x = document.querySelector('ins');
var txt = "";
var i;
for (i = 0; i < x.attributes.length; i++) {
txt = txt + x.attributes[i].name + " = " + x.attributes[i].value + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}

<!DOCTYPE html>
<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
<insA class='scales_chords_api'></insA>
<br/><br/>
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>
</body
</html>








share|improve this answer





















  • That's weird. What browser are you using? If I put the script tag before the ins tag, like you doing, it doesn't work here. I have tried both Chrome and Safari.
    – Ricardo de Paula Soares
    Nov 13 at 2:58










  • I used firefox Quantum 63.0.1. No errors in console. Checked Chrome. Works there as well.
    – Kurenai Kunai
    Nov 13 at 3:17













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53218062%2fhow-to-set-nonstandard-attribute-in-html-using-javascript%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










Place the scripts after the ins tag. The document loads from top to bottom; the tag needs to exist first before a script can do anything with it.



In general practice, scripts should be placed at the very bottom, right before </body>.






<body>
<ins class='scales_chords_api'></ins>
...
<script>
const insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'b');
</script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>
</body>





In the snippet above I added the JS code directly in the HTML, but adding it in your index.js file is fine too. As long as you load that first, followed by the API.






share|improve this answer























  • Unfortunately it didn't work. I have actually tried your suggestion before, sorry for not mentioning it in the question. I think the reason why this approach is not working is because the api doesn't recognize the attribute 'data-chord'. It expects 'chord' instead. But this is just a thought that occured to me.
    – Ricardo de Paula Soares
    Nov 9 at 14:14










  • I figured it out, rewrote my answer completely with working code.
    – LionelW
    Nov 11 at 12:12















up vote
0
down vote



accepted










Place the scripts after the ins tag. The document loads from top to bottom; the tag needs to exist first before a script can do anything with it.



In general practice, scripts should be placed at the very bottom, right before </body>.






<body>
<ins class='scales_chords_api'></ins>
...
<script>
const insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'b');
</script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>
</body>





In the snippet above I added the JS code directly in the HTML, but adding it in your index.js file is fine too. As long as you load that first, followed by the API.






share|improve this answer























  • Unfortunately it didn't work. I have actually tried your suggestion before, sorry for not mentioning it in the question. I think the reason why this approach is not working is because the api doesn't recognize the attribute 'data-chord'. It expects 'chord' instead. But this is just a thought that occured to me.
    – Ricardo de Paula Soares
    Nov 9 at 14:14










  • I figured it out, rewrote my answer completely with working code.
    – LionelW
    Nov 11 at 12:12













up vote
0
down vote



accepted







up vote
0
down vote



accepted






Place the scripts after the ins tag. The document loads from top to bottom; the tag needs to exist first before a script can do anything with it.



In general practice, scripts should be placed at the very bottom, right before </body>.






<body>
<ins class='scales_chords_api'></ins>
...
<script>
const insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'b');
</script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>
</body>





In the snippet above I added the JS code directly in the HTML, but adding it in your index.js file is fine too. As long as you load that first, followed by the API.






share|improve this answer














Place the scripts after the ins tag. The document loads from top to bottom; the tag needs to exist first before a script can do anything with it.



In general practice, scripts should be placed at the very bottom, right before </body>.






<body>
<ins class='scales_chords_api'></ins>
...
<script>
const insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'b');
</script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>
</body>





In the snippet above I added the JS code directly in the HTML, but adding it in your index.js file is fine too. As long as you load that first, followed by the API.






<body>
<ins class='scales_chords_api'></ins>
...
<script>
const insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'b');
</script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>
</body>





<body>
<ins class='scales_chords_api'></ins>
...
<script>
const insTag = document.querySelector('ins');
insTag.setAttribute('chord', 'b');
</script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>
</body>






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 13 at 1:41

























answered Nov 9 at 2:47









LionelW

19216




19216












  • Unfortunately it didn't work. I have actually tried your suggestion before, sorry for not mentioning it in the question. I think the reason why this approach is not working is because the api doesn't recognize the attribute 'data-chord'. It expects 'chord' instead. But this is just a thought that occured to me.
    – Ricardo de Paula Soares
    Nov 9 at 14:14










  • I figured it out, rewrote my answer completely with working code.
    – LionelW
    Nov 11 at 12:12


















  • Unfortunately it didn't work. I have actually tried your suggestion before, sorry for not mentioning it in the question. I think the reason why this approach is not working is because the api doesn't recognize the attribute 'data-chord'. It expects 'chord' instead. But this is just a thought that occured to me.
    – Ricardo de Paula Soares
    Nov 9 at 14:14










  • I figured it out, rewrote my answer completely with working code.
    – LionelW
    Nov 11 at 12:12
















Unfortunately it didn't work. I have actually tried your suggestion before, sorry for not mentioning it in the question. I think the reason why this approach is not working is because the api doesn't recognize the attribute 'data-chord'. It expects 'chord' instead. But this is just a thought that occured to me.
– Ricardo de Paula Soares
Nov 9 at 14:14




Unfortunately it didn't work. I have actually tried your suggestion before, sorry for not mentioning it in the question. I think the reason why this approach is not working is because the api doesn't recognize the attribute 'data-chord'. It expects 'chord' instead. But this is just a thought that occured to me.
– Ricardo de Paula Soares
Nov 9 at 14:14












I figured it out, rewrote my answer completely with working code.
– LionelW
Nov 11 at 12:12




I figured it out, rewrote my answer completely with working code.
– LionelW
Nov 11 at 12:12












up vote
0
down vote













Remove your scripts after dom. Because there was no element before your code ran



snap



[code in jsfiddle](http://jsfiddle.net/o4kujx8t/)





share|improve this answer























  • Could you please elaborate a bit more on your suggestion. Thank you.
    – Ricardo de Paula Soares
    Nov 9 at 14:07










  • Thanks for your efforts in trying to help. It worked.
    – Ricardo de Paula Soares
    Nov 13 at 3:01















up vote
0
down vote













Remove your scripts after dom. Because there was no element before your code ran



snap



[code in jsfiddle](http://jsfiddle.net/o4kujx8t/)





share|improve this answer























  • Could you please elaborate a bit more on your suggestion. Thank you.
    – Ricardo de Paula Soares
    Nov 9 at 14:07










  • Thanks for your efforts in trying to help. It worked.
    – Ricardo de Paula Soares
    Nov 13 at 3:01













up vote
0
down vote










up vote
0
down vote









Remove your scripts after dom. Because there was no element before your code ran



snap



[code in jsfiddle](http://jsfiddle.net/o4kujx8t/)





share|improve this answer














Remove your scripts after dom. Because there was no element before your code ran



snap



[code in jsfiddle](http://jsfiddle.net/o4kujx8t/)






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 at 3:12

























answered Nov 9 at 1:30









ashe

11




11












  • Could you please elaborate a bit more on your suggestion. Thank you.
    – Ricardo de Paula Soares
    Nov 9 at 14:07










  • Thanks for your efforts in trying to help. It worked.
    – Ricardo de Paula Soares
    Nov 13 at 3:01


















  • Could you please elaborate a bit more on your suggestion. Thank you.
    – Ricardo de Paula Soares
    Nov 9 at 14:07










  • Thanks for your efforts in trying to help. It worked.
    – Ricardo de Paula Soares
    Nov 13 at 3:01
















Could you please elaborate a bit more on your suggestion. Thank you.
– Ricardo de Paula Soares
Nov 9 at 14:07




Could you please elaborate a bit more on your suggestion. Thank you.
– Ricardo de Paula Soares
Nov 9 at 14:07












Thanks for your efforts in trying to help. It worked.
– Ricardo de Paula Soares
Nov 13 at 3:01




Thanks for your efforts in trying to help. It worked.
– Ricardo de Paula Soares
Nov 13 at 3:01










up vote
0
down vote













Am I missing something? It seems to be working for me.






var insTag = document.querySelector('ins');
insTag.setAttribute('chord', '4');

var insTagA = document.body.getElementsByTagName('insA');
for(var i = 0;i < insTagA.length; i++){
insTagA[i].setAttribute('chordA', 'value');
}


console.log(insTag.getAttribute('chord'));
console.log(insTagA[0].getAttribute('chordA'));

function myFunction() {
var x = document.querySelector('ins');
var txt = "";
var i;
for (i = 0; i < x.attributes.length; i++) {
txt = txt + x.attributes[i].name + " = " + x.attributes[i].value + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}

<!DOCTYPE html>
<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
<insA class='scales_chords_api'></insA>
<br/><br/>
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>
</body
</html>








share|improve this answer





















  • That's weird. What browser are you using? If I put the script tag before the ins tag, like you doing, it doesn't work here. I have tried both Chrome and Safari.
    – Ricardo de Paula Soares
    Nov 13 at 2:58










  • I used firefox Quantum 63.0.1. No errors in console. Checked Chrome. Works there as well.
    – Kurenai Kunai
    Nov 13 at 3:17

















up vote
0
down vote













Am I missing something? It seems to be working for me.






var insTag = document.querySelector('ins');
insTag.setAttribute('chord', '4');

var insTagA = document.body.getElementsByTagName('insA');
for(var i = 0;i < insTagA.length; i++){
insTagA[i].setAttribute('chordA', 'value');
}


console.log(insTag.getAttribute('chord'));
console.log(insTagA[0].getAttribute('chordA'));

function myFunction() {
var x = document.querySelector('ins');
var txt = "";
var i;
for (i = 0; i < x.attributes.length; i++) {
txt = txt + x.attributes[i].name + " = " + x.attributes[i].value + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}

<!DOCTYPE html>
<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
<insA class='scales_chords_api'></insA>
<br/><br/>
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>
</body
</html>








share|improve this answer





















  • That's weird. What browser are you using? If I put the script tag before the ins tag, like you doing, it doesn't work here. I have tried both Chrome and Safari.
    – Ricardo de Paula Soares
    Nov 13 at 2:58










  • I used firefox Quantum 63.0.1. No errors in console. Checked Chrome. Works there as well.
    – Kurenai Kunai
    Nov 13 at 3:17















up vote
0
down vote










up vote
0
down vote









Am I missing something? It seems to be working for me.






var insTag = document.querySelector('ins');
insTag.setAttribute('chord', '4');

var insTagA = document.body.getElementsByTagName('insA');
for(var i = 0;i < insTagA.length; i++){
insTagA[i].setAttribute('chordA', 'value');
}


console.log(insTag.getAttribute('chord'));
console.log(insTagA[0].getAttribute('chordA'));

function myFunction() {
var x = document.querySelector('ins');
var txt = "";
var i;
for (i = 0; i < x.attributes.length; i++) {
txt = txt + x.attributes[i].name + " = " + x.attributes[i].value + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}

<!DOCTYPE html>
<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
<insA class='scales_chords_api'></insA>
<br/><br/>
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>
</body
</html>








share|improve this answer












Am I missing something? It seems to be working for me.






var insTag = document.querySelector('ins');
insTag.setAttribute('chord', '4');

var insTagA = document.body.getElementsByTagName('insA');
for(var i = 0;i < insTagA.length; i++){
insTagA[i].setAttribute('chordA', 'value');
}


console.log(insTag.getAttribute('chord'));
console.log(insTagA[0].getAttribute('chordA'));

function myFunction() {
var x = document.querySelector('ins');
var txt = "";
var i;
for (i = 0; i < x.attributes.length; i++) {
txt = txt + x.attributes[i].name + " = " + x.attributes[i].value + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}

<!DOCTYPE html>
<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
<insA class='scales_chords_api'></insA>
<br/><br/>
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>
</body
</html>








var insTag = document.querySelector('ins');
insTag.setAttribute('chord', '4');

var insTagA = document.body.getElementsByTagName('insA');
for(var i = 0;i < insTagA.length; i++){
insTagA[i].setAttribute('chordA', 'value');
}


console.log(insTag.getAttribute('chord'));
console.log(insTagA[0].getAttribute('chordA'));

function myFunction() {
var x = document.querySelector('ins');
var txt = "";
var i;
for (i = 0; i < x.attributes.length; i++) {
txt = txt + x.attributes[i].name + " = " + x.attributes[i].value + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}

<!DOCTYPE html>
<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
<insA class='scales_chords_api'></insA>
<br/><br/>
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>
</body
</html>





var insTag = document.querySelector('ins');
insTag.setAttribute('chord', '4');

var insTagA = document.body.getElementsByTagName('insA');
for(var i = 0;i < insTagA.length; i++){
insTagA[i].setAttribute('chordA', 'value');
}


console.log(insTag.getAttribute('chord'));
console.log(insTagA[0].getAttribute('chordA'));

function myFunction() {
var x = document.querySelector('ins');
var txt = "";
var i;
for (i = 0; i < x.attributes.length; i++) {
txt = txt + x.attributes[i].name + " = " + x.attributes[i].value + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}

<!DOCTYPE html>
<html>
<body>
<script src='./index.js'></script>
<script src='https://www.scales-chords.com/api/scales-chords-api.js'></script>

<ins class='scales_chords_api'></ins>
<insA class='scales_chords_api'></insA>
<br/><br/>
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>
</body
</html>






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 at 2:24









Kurenai Kunai

1,4802720




1,4802720












  • That's weird. What browser are you using? If I put the script tag before the ins tag, like you doing, it doesn't work here. I have tried both Chrome and Safari.
    – Ricardo de Paula Soares
    Nov 13 at 2:58










  • I used firefox Quantum 63.0.1. No errors in console. Checked Chrome. Works there as well.
    – Kurenai Kunai
    Nov 13 at 3:17




















  • That's weird. What browser are you using? If I put the script tag before the ins tag, like you doing, it doesn't work here. I have tried both Chrome and Safari.
    – Ricardo de Paula Soares
    Nov 13 at 2:58










  • I used firefox Quantum 63.0.1. No errors in console. Checked Chrome. Works there as well.
    – Kurenai Kunai
    Nov 13 at 3:17


















That's weird. What browser are you using? If I put the script tag before the ins tag, like you doing, it doesn't work here. I have tried both Chrome and Safari.
– Ricardo de Paula Soares
Nov 13 at 2:58




That's weird. What browser are you using? If I put the script tag before the ins tag, like you doing, it doesn't work here. I have tried both Chrome and Safari.
– Ricardo de Paula Soares
Nov 13 at 2:58












I used firefox Quantum 63.0.1. No errors in console. Checked Chrome. Works there as well.
– Kurenai Kunai
Nov 13 at 3:17






I used firefox Quantum 63.0.1. No errors in console. Checked Chrome. Works there as well.
– Kurenai Kunai
Nov 13 at 3:17




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53218062%2fhow-to-set-nonstandard-attribute-in-html-using-javascript%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

List item for chat from Array inside array React Native

Thiostrepton

Caerphilly