我在jsfiddle上有以下內容。我需要完成的是當我點擊一個按鈕時,相應的值被插入到空白處。如何分配單擊按鈕的值
https://jsfiddle.net/aminbaig/jefee77L/
這裏是代碼:
HTML:
的Javascript:
function change() {
var myNewTitle = document.getElementById('myTextField').value;
if (myNewTitle.length == 0) {
alert('Write Some real Text please.');
return;
}
var title = document.getElementById('title');
title.innerHTML = myNewTitle;
}