0

As the question speaks itself I am having trouble using jQuery as even the simple functions are throwing Uncaught SyntaxError: Unexpected token ILLEGAL on Page load and I don't have enough knowledge of jQuery to solve such problems myself.

here are the details:

  1. Library on page head:

    <script src="http://code.jquery.com/jquery-1.7.2.js" type="text/javascript"></script>
    <script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"></script>
    
  2. jQuery popupwindow function:

    <script type="text/javascript">    
            $(document).ready(function() {
               $('#<%=_btstrtTest.ClientID %>').click(function() {
                 var NWin = window.open($(this).prop('href'), 'height=800,width=800');
                 if (window.focus) 
                 {<br/>
                   NWin.focus();
                 }<br/>
                 return false;
                });
            });​
        </script>
    


FYI: I am not using ASP.Net MVC, just plain ASP.Net with C# and the head is coming from master page while the function is in Contentplaceholder of the home.aspx page if that helps.

Thanks

Sam R.
  • 16,027
  • 12
  • 69
  • 122
Alok
  • 808
  • 13
  • 40

2 Answers2

1

Delete all invisible characters (whitespace) around that area, then give it another try.

I've seen that error in Safari when copy/pasting code. You can pick up some invalid (and unfortunately invisible) characters.

Used to happen to me a lot when copying from jsFiddle.

and add single jQuery Library file either full or min

mastermind
  • 1,057
  • 1
  • 8
  • 15
  • I had the exact same issue. It wasn't whitespace, but extra characters like this..... OnClientClick="ClosePopup('ModalWindowLP');();". I removed the (); and it worked fine. – Dirk Strauss Dec 20 '16 at 14:38
0

Remove the semicolon before the last one.

<script type="text/javascript">    
        $(document).ready(function() {
           $('#<%=_btstrtTest.ClientID %>').click(function() {
             var NWin = window.open($(this).prop('href'), 'height=800,width=800');
             if (window.focus) 
             {<br/>
               NWin.focus();
             }<br/>
             return false;
            })
        });​
    </script>
chamara
  • 12,649
  • 32
  • 134
  • 210