Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How create a function that return element in js

function elem(did) {
  return document.getElementById(did);
}
register_fm = elem('register_fm');
//---------------OR---------
function elem(did) {
  return document.querySelector(did);
}
register_fm = elem('#register_fm');
register_fm = elem('.register_fm');
register_fm = elem('p');
register_fm = elem('div');
 
PREVIOUS NEXT
Tagged: #How #create #function #return #element #js
ADD COMMENT
Topic
Name
6+3 =