You need to add units, like px
.
function resetSize(elementId, height, width){
var el = document.getElementById(elementId);
el.style.height = height + "px";
el.style.width = width + "px";
}
The above way is hardcoded to "px"
. You could pass the unit instead.
function resetSize(elementId, height, width, unit){
var el = document.getElementById(elementId);
el.style.height = height + (unit || "px");
el.style.width = width + (unit || "px");
}
resetSize('demo', 500, 500, "px");
Or just include it directly in the value, and use the original function.
resetSize('demo', "500px", "500px");