How do i declare a default value in a function? I have a simple function
[CODE]
function color_input(id,token){
if (!empty(token)){
document.getElementById(id).style.backgroundColor = ‘#2A2A2A’;
document.getElementById(id).style.color = ‘#DDC58C’;
}else{
document.getElementById(id).style.backgroundColor = ”;
document.getElementById(id).style.color = ”;
}
}
Called in HTML like
[code=html]<input type=”text” id=”example_name” onblur=”color_input(‘example_name’);”>
You will notice that the #2 parameter is missing in the html call. Sometimes i don’t have it to send. in PHP i would just set the functions second param like token=”
[CODE]function color_input(id,token=”){}
How do i set a default param in a JS function?