I have the following Javascript functions. Yes() and No(). I want to add another function Ex(), but it won't let me? Yes() and No() just stop working when I add it, no matter where it's added in the code.
Can somebody please explain what's wrong? Thanks.
function no() {
location.reload();
}
function yes() {
document.getElementById('ex').innerHTML = "<button onclick="ex()">Test</button>;
}
function ex() {
alert('test');
}
"<button onclick=\"ex()\">Test</button>";You were missing the last quotation mark and escaping the inner ones.