I'm working with functions in which I must pass ( Mandatory ) a DOM element. This function will work with the properties of this DOM element.
Example
function changeValue(elem, value){
elem.value = value;
}
var input = document.getElementsByTagName('input')[0];
changeValue(input, input.value.toUpperCase());
<input name="name" value="Guilherme" />
Doubt
- How to check if the element is really a DOM element?
and not an instance of
jQuery
or{ value : 'Guilherme'}
.