how compare symbols in javascript? have left arrow in program , not working:
<input type="button" id="backspace" value="←" /> document.getelementbyid("backspace").onclick=function (){display_ctrl(this.value);}; function display_ctrl(parameter){ if (parameter=="←"){alert("this left arrow");}
how can compare whether particular symbol?
try using unicode instead - "\u2190"
left arrow.
> "←" "←" > "\u2190" "←"
your code become (i have formatted more readable):
document.getelementbyid("backspace").onclick = function() { display_ctrl(this.value); } function display_ctrl(parameter) { if (parameter == "\u2190") { alert("this left arrow"); } }
Comments
Post a Comment