Javascript: Weird illegal character error in if statement

I am afraid with a strange syntax error from yesterday: the FF debugger keeps saying "SyntaxError: illegal character" on this particular line:

function newTimePeriod(ID, param, paramID, unit)
{
    updateSession();
    //check if date
    //(I got this regex from another post)
    var re = new RegExp("^\\d{4,4}(-\\d{1,2}){1,2}( \\d{1,2}(:\\d{1,2}){1,2})?$");

    var dateFrom = document.getElementById("chart_date_min_" + ID).value;
    var dateTo = document.getElementById("chart_date_max_" + ID).value;
    var fromCorrect = re.test(dateFrom);  
    var toCorrect = re.test(dateFrom);  
    /**/if (fromCorrect && toCorrect)​{/**/   //return illegal character
    LoadGraph(ID, param, paramID, unit, dateFrom, dateTo);
    }
}

I tried to include this script in the php main page or to separate it; this does not change anything. The encoding used is UTF-8, and fromCorrect and toCorrect correctly returns a boolean value (regular expression works)

When I delete the if statement, the script loads ... Notepad ++ does not show any special characters hiding anywhere.

Any thoughts?

+1
source share
2 answers

fiddle - , :

if (fromCorrect && toCorrect)​{
                             ^
+5

, , - , .

+3

All Articles