this is my code in JavaScript:
var changeIdValue = function(id, value) {
document.getElementById(id).style.height = value;
};
document.getElementById ("balklongwaarde").addEventListener("click", function(){ changeIdValue("balklongwaarde", "60px")});
document.getElementById ("balklevensverwachting").addEventListener("click", function(){ changeIdValue("balklevensverwachting", "60px")});
document.getElementById ("balkhart").addEventListener("click", function(){ changeIdValue("balkhart", "60px")});
document.getElementById ("balklever").addEventListener("click", function(){ changeIdValue("balklever", "60px")});
document.getElementById("balkhersenen").addEventListener("click", function(){ changeIdValue("balkhersenen", "60px")});
I want to execute this code after press on keyup....
Has anyone an idea how?
In JQuery events are normalised under which event property.
You can find any key value here eg:spacebar value(32).
This function may help you.
document.activeElement
is whatever element has focus. You'll often find both spacebar and enter firing click on the focused element.Then the CSS might be:
The 2019 version of this would be: (works in all major browsers - Chrome, Firefox, Safari)
Spec link - https://www.w3.org/TR/uievents/#dom-keyboardevent-code
This will be executed after you hit spacebar.
JSFiddle.