I've problem writing javascript in PHP code. Here my script :
echo ' <script>';
echo ' $(function(){';
echo ' x = parseInt($("#counter2").val());';
echo ' $("#add_row2").click(function(){';
echo ' $("#addr2"+x).html("<td align="right">\'+ (x+1) +\'</td><td class="col-xs-2"><input type="text" name="vprice[]" class="required form-control text-right"></td><td class="col-xs-2"><input type=text" name="vminorder[]" class="required form-control text-right"></td>");';
echo ' $("#tab_logic2").append("<tr id="addr2\'+ x+1 +\'"></tr>");';
echo ' x++;';
echo ' });';
echo ' $("#delete_row2").click(function(){';
echo ' if(x> 1){';
echo ' $("#addr2"+(x-1)).html("");';
echo ' x--;';
echo ' }';
echo ' });';
echo ' });';
echo ' </script>';
When running it is produce an error Uncaught SyntaxError: missing ) after argument list in line
echo ' $("#addr2"+x).html("<td align="right">\'+ (x+1) +\'</td><td class="col-xs-2"><input type="text" name="vprice[]" class="required form-control text-right"></td><td class="col-xs-2"><input type=text" name="vminorder[]" class="required form-control text-right"></td>");';
echo ' $("#tab_logic2").append("<tr id="addr2\'+ x+1 +\'"></tr>");';
Because in this line have variable I use quotes and wrap it with \ tag. It still error.
Any sugesstion?