title: Chrome Uncaught Syntax Error: Unexpected Token <
body: <p>I'm running this script in order to display different menu for mobile:</p>
  
  <pre><code>&lt;script&gt;
      jQuery(document).ready(function($){
          if ($(window).width() &gt; 750){
              &lt;?php wp_nav_menu( array( 'theme_location' =&gt; 'primary', 'container' =&gt; false, 'menu_class' =&gt; 'menu clearfix' ) ); ?&gt;
          }else{
              &lt;?php wp_nav_menu( array( 'theme_location' =&gt; 'mobile', 'container' =&gt; false, 'menu_class' =&gt; 'menu clearfix' ) ); ?&gt;
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>But I get error by chrome "Uncaught SyntaxError: Unexpected token &lt;" pointing my to that line:</p>
  
  <p><a href="https://i.stack.imgur.com/oGIyD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oGIyD.jpg" alt="enter image description here"></a>
  I can't figure whats wrong with the code, any help will be appreciated. </p>
  
  <p><strong>EDIT</strong>: well, didn't know there is a problem running php inside js.
  So what's the proper solution to my situation? I know I can just use css media queries and the display property, but it's bad for the performance, isn't it?  </p>