所以我試圖編輯單擊按鈕時的顏色。 這裏是我的HTML和JavaScriptbutton.js中的按鈕背景顏色
HTML:
<button type="submit" class="btn" id="hello-1" value="hello">Submit</button>
這裏是我的JS:
//Name:buttons.js
//Created by: Jonathan
//Created on: 25/09/15.
'use stict';
$(document).ready(function(){
$('hello-1').click(function(){
document.getElementById('hello-1').style.background = "linear-gradient(#337AB7,#215480)";
});
});
我不明白爲什麼它不工作。任何幫助?
只需添加一個#因爲它的ID。 – Manu