0
我已經使用道具jQuery語法啓用我的保存按鈕並禁用編輯按鈕後點擊編輯按鈕的事件,我不知道爲什麼它是不可見的,而不是啓用保存按鈕。prop()隱藏我的按鈕,而不是禁用
$(document).ready(function() {
$('#saveProject').click(function() {
$('#editProject').prop("disabled", false);
$('#saveProject').prop("disabled", true);
$('.fields').prop("disabled", true);
$('.fields').css({
"border-bottom": "4px solid teal"
});
});
$('#editProject').click(function() {
$('#saveProject').prop("disabled", false);
$('.fields').prop("disabled", false);
$('.green').css({
"border-bottom": "4px solid green"
});
$('.red').css({
"border-bottom": "4px solid red"
});
$('#editProject').prop("disabled", true);
});
$('#clearProject').click(function() {
$('#clearProject').prop("disabled", false);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="w3-red">
<input id="saveProject" type="submit" class="w3-button w3-right w3-col m3" style="background-color:#030066;" value="Save Project" disabled="disabled">
<input id="editProject" class="w3-button w3-right w3-rightbar w3-col m2" style="background-color:#030066;" value="Edit">
<input id="clearProject" class="w3-button w3-right w3-rightbar w3-col m4" style="background-color:#030066;" value="Default Values" type="reset">
</div>
你可能有一個類型的錯誤'$( '#saveProject.visible')'應該是不是'$('#saveProject:visible')' –
不,這不是我剛剛試驗過的實際語法。可見在那裏,當我嘗試你的方式..仍然沒有任何反應 –
*「我不知道爲什麼它是不可見的,而不是啓用保存按鈕。」*什麼? 0_0 – zer00ne