Home > Web Front-end > JS Tutorial > body text

getElementByIdx_x js custom getElementById function_javascript skills

WBOY
Release: 2016-05-16 17:56:47
Original
1809 people have browsed it

Function code:

Copy code The code is as follows:

document.getElementByIdx_x=function(id){
if(typeof id =='string')
return document.getElementById(id);
else
throw new error('please pass a string as a id!')
}

Example code:
Copy code The code is as follows:

9

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template