the close parenthesis is there, why does it say it is missing the parenthesis?Creating multiline strings in JavaScriptHow to remove close button on the jQuery UI dialog?Why aren't my dynamically-added form inputs posting?What does jQuery.fn mean?Append element problemBind a function to Twitter Bootstrap Modal CloseDisallow Twitter Bootstrap modal window from closingjquery - get src of image set by picturefillWhy does jQuery or a DOM method such as getElementById not find the element?Why does my JavaScript code get a “No 'Access-Control-Allow-Origin' header is present on the requested resource” error when Postman does not?Appending to dynamic content

"I you already know": is this proper English?

Spoken encryption

Is it correct to translate English noun adjuncts into adjectives?

How may I concisely assign different values to a variable, depending on another variable?

Which Roman general was killed by his own soldiers for not letting them to loot a newly conquered city?

(1 of 11: Numberlink) What is Pyramid Cult's Favorite Activity?

Why is my read in of data taking so long?

Why can't my huge trees be chopped down?

Commercial jet accompanied by small plane near Seattle

Is it legal to use cash pulled from a credit card to pay the monthly payment on that credit card?

Can the Artificer's infusions stack? Returning weapon + radiant weapon?

Automatic Habit of Meditation

Is there a reason why I should not use the HaveIBeenPwned API to warn users about exposed passwords?

Can two figures have the same area, perimeter, and same number of segments have different shape?

How to copy a file transactionally?

How can I make sure my players' decisions have consequences?

How do I run a game when my PCs have different approaches to combat?

On the strategic interest of giving long lasting stock orders

How acidic does a mixture have to be for milk to curdle?

How to get the two pictures aligned

What are the exact meanings of roll, pitch and yaw?

Why isn't my platform event chain working?

Why was Sauron not trying to find the Ring, and instead of preparing for war?

Invert Some Switches on a Switchboard



the close parenthesis is there, why does it say it is missing the parenthesis?


Creating multiline strings in JavaScriptHow to remove close button on the jQuery UI dialog?Why aren't my dynamically-added form inputs posting?What does jQuery.fn mean?Append element problemBind a function to Twitter Bootstrap Modal CloseDisallow Twitter Bootstrap modal window from closingjquery - get src of image set by picturefillWhy does jQuery or a DOM method such as getElementById not find the element?Why does my JavaScript code get a “No 'Access-Control-Allow-Origin' header is present on the requested resource” error when Postman does not?Appending to dynamic content






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















Why wouldn't this work? I'm not sure why it says there's a syntax error, it says missing a parenthesis for .append() when the ending parenthesis is clearly there (line 32).



enter image description here



I was told the backslash is used for line breaks in .append()



for(var i = 0; i < works.length; ++i) 
$('#work').append('
<div class='col-sm'>
<img class='img-responsive' src='" + works[i] + "'>
</div>
'); //THIS IS THE END PARENTHESIS FOR .APPEND()
;


I expect the images in an array to be displayed in my webpage. The array is called 'works'.










share|improve this question



















  • 4





    unescaped single quotes in value

    – Taplar
    Mar 26 at 16:50







  • 3





    try using ticks instead of quotes if you want multi line strings - ` (the thing left of the 1), also solves your unescaped quotes problem

    – Pete
    Mar 26 at 16:50







  • 2





    Just put it all on one line. You're not really improving readability all that much with those line continuation characters, and it makes it more difficult to maintain anyway.

    – Robert Harvey
    Mar 26 at 16:50


















0















Why wouldn't this work? I'm not sure why it says there's a syntax error, it says missing a parenthesis for .append() when the ending parenthesis is clearly there (line 32).



enter image description here



I was told the backslash is used for line breaks in .append()



for(var i = 0; i < works.length; ++i) 
$('#work').append('
<div class='col-sm'>
<img class='img-responsive' src='" + works[i] + "'>
</div>
'); //THIS IS THE END PARENTHESIS FOR .APPEND()
;


I expect the images in an array to be displayed in my webpage. The array is called 'works'.










share|improve this question



















  • 4





    unescaped single quotes in value

    – Taplar
    Mar 26 at 16:50







  • 3





    try using ticks instead of quotes if you want multi line strings - ` (the thing left of the 1), also solves your unescaped quotes problem

    – Pete
    Mar 26 at 16:50







  • 2





    Just put it all on one line. You're not really improving readability all that much with those line continuation characters, and it makes it more difficult to maintain anyway.

    – Robert Harvey
    Mar 26 at 16:50














0












0








0








Why wouldn't this work? I'm not sure why it says there's a syntax error, it says missing a parenthesis for .append() when the ending parenthesis is clearly there (line 32).



enter image description here



I was told the backslash is used for line breaks in .append()



for(var i = 0; i < works.length; ++i) 
$('#work').append('
<div class='col-sm'>
<img class='img-responsive' src='" + works[i] + "'>
</div>
'); //THIS IS THE END PARENTHESIS FOR .APPEND()
;


I expect the images in an array to be displayed in my webpage. The array is called 'works'.










share|improve this question
















Why wouldn't this work? I'm not sure why it says there's a syntax error, it says missing a parenthesis for .append() when the ending parenthesis is clearly there (line 32).



enter image description here



I was told the backslash is used for line breaks in .append()



for(var i = 0; i < works.length; ++i) 
$('#work').append('
<div class='col-sm'>
<img class='img-responsive' src='" + works[i] + "'>
</div>
'); //THIS IS THE END PARENTHESIS FOR .APPEND()
;


I expect the images in an array to be displayed in my webpage. The array is called 'works'.







jquery






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 16:49









Robert Harvey

152k37 gold badges290 silver badges426 bronze badges




152k37 gold badges290 silver badges426 bronze badges










asked Mar 26 at 16:45









Winnie CaiWinnie Cai

81 bronze badge




81 bronze badge







  • 4





    unescaped single quotes in value

    – Taplar
    Mar 26 at 16:50







  • 3





    try using ticks instead of quotes if you want multi line strings - ` (the thing left of the 1), also solves your unescaped quotes problem

    – Pete
    Mar 26 at 16:50







  • 2





    Just put it all on one line. You're not really improving readability all that much with those line continuation characters, and it makes it more difficult to maintain anyway.

    – Robert Harvey
    Mar 26 at 16:50













  • 4





    unescaped single quotes in value

    – Taplar
    Mar 26 at 16:50







  • 3





    try using ticks instead of quotes if you want multi line strings - ` (the thing left of the 1), also solves your unescaped quotes problem

    – Pete
    Mar 26 at 16:50







  • 2





    Just put it all on one line. You're not really improving readability all that much with those line continuation characters, and it makes it more difficult to maintain anyway.

    – Robert Harvey
    Mar 26 at 16:50








4




4





unescaped single quotes in value

– Taplar
Mar 26 at 16:50






unescaped single quotes in value

– Taplar
Mar 26 at 16:50





3




3





try using ticks instead of quotes if you want multi line strings - ` (the thing left of the 1), also solves your unescaped quotes problem

– Pete
Mar 26 at 16:50






try using ticks instead of quotes if you want multi line strings - ` (the thing left of the 1), also solves your unescaped quotes problem

– Pete
Mar 26 at 16:50





2




2





Just put it all on one line. You're not really improving readability all that much with those line continuation characters, and it makes it more difficult to maintain anyway.

– Robert Harvey
Mar 26 at 16:50






Just put it all on one line. You're not really improving readability all that much with those line continuation characters, and it makes it more difficult to maintain anyway.

– Robert Harvey
Mar 26 at 16:50













3 Answers
3






active

oldest

votes


















0














If you are using single quotes to enclose your appended string, you should use double quotes inside of those or you need to escape the other single quotes contained in the opening and closing single quotes, I would go with the latter way of doing it, and change to this:



$('#work').append('<div class="col-sm"><img class="img-responsive" src="' + works[i] + '"></div>'); //THIS IS THE END PARENTHESIS FOR .APPEND()





share|improve this answer




















  • 1





    Not the down vote, but the use of `` is for escaping the new line, which can be a valid approach.

    – Taplar
    Mar 26 at 16:52











  • @Taplar Yeah, I realized that after I read a comment above and updated my answer, thanks for the information, I've never used that before, typically if I append to a string on multiple lines I just use the + sign at the end of a line

    – Ryan Wilson
    Mar 26 at 16:54












  • stackoverflow.com/questions/805107/…

    – j08691
    Mar 26 at 16:56











  • @Pete thanks, I missed that last one when editing.

    – Ryan Wilson
    Mar 26 at 16:57


















3














If you are in a position to use ES6, the template literal is here to remove the complexity/annoyance of multi-line string escaping.






const works = ['http://placekitten.com/150/150', 'http://placekitten.com/200/200']

for (let i = 0; i < works.length; ++i)
$('#work').append(`
<div class='col - sm '>
<img class='img - responsive' src='$works[i]' alt=''>
</div>
`);
;

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="work"></div>








share|improve this answer






























    1














    Take a look at the syntax highlight, you're closing the quotes and the interpreter is reading variables next to your string literals therefore throwing syntax errors, I'd encourage you to use ES6 Template literals or pay close attention to how you are using single and double quotes



    Try this



    for(var i = 0; i < works.length; ++i) 
    $('#work').append(`
    <div class='col-sm'>
    <img class='img-responsive' src='$works[i]>
    </div>
    `); //THIS IS THE END PARENTHESIS FOR .APPEND()
    ;





    share|improve this answer

























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362288%2fthe-close-parenthesis-is-there-why-does-it-say-it-is-missing-the-parenthesis%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      If you are using single quotes to enclose your appended string, you should use double quotes inside of those or you need to escape the other single quotes contained in the opening and closing single quotes, I would go with the latter way of doing it, and change to this:



      $('#work').append('<div class="col-sm"><img class="img-responsive" src="' + works[i] + '"></div>'); //THIS IS THE END PARENTHESIS FOR .APPEND()





      share|improve this answer




















      • 1





        Not the down vote, but the use of `` is for escaping the new line, which can be a valid approach.

        – Taplar
        Mar 26 at 16:52











      • @Taplar Yeah, I realized that after I read a comment above and updated my answer, thanks for the information, I've never used that before, typically if I append to a string on multiple lines I just use the + sign at the end of a line

        – Ryan Wilson
        Mar 26 at 16:54












      • stackoverflow.com/questions/805107/…

        – j08691
        Mar 26 at 16:56











      • @Pete thanks, I missed that last one when editing.

        – Ryan Wilson
        Mar 26 at 16:57















      0














      If you are using single quotes to enclose your appended string, you should use double quotes inside of those or you need to escape the other single quotes contained in the opening and closing single quotes, I would go with the latter way of doing it, and change to this:



      $('#work').append('<div class="col-sm"><img class="img-responsive" src="' + works[i] + '"></div>'); //THIS IS THE END PARENTHESIS FOR .APPEND()





      share|improve this answer




















      • 1





        Not the down vote, but the use of `` is for escaping the new line, which can be a valid approach.

        – Taplar
        Mar 26 at 16:52











      • @Taplar Yeah, I realized that after I read a comment above and updated my answer, thanks for the information, I've never used that before, typically if I append to a string on multiple lines I just use the + sign at the end of a line

        – Ryan Wilson
        Mar 26 at 16:54












      • stackoverflow.com/questions/805107/…

        – j08691
        Mar 26 at 16:56











      • @Pete thanks, I missed that last one when editing.

        – Ryan Wilson
        Mar 26 at 16:57













      0












      0








      0







      If you are using single quotes to enclose your appended string, you should use double quotes inside of those or you need to escape the other single quotes contained in the opening and closing single quotes, I would go with the latter way of doing it, and change to this:



      $('#work').append('<div class="col-sm"><img class="img-responsive" src="' + works[i] + '"></div>'); //THIS IS THE END PARENTHESIS FOR .APPEND()





      share|improve this answer















      If you are using single quotes to enclose your appended string, you should use double quotes inside of those or you need to escape the other single quotes contained in the opening and closing single quotes, I would go with the latter way of doing it, and change to this:



      $('#work').append('<div class="col-sm"><img class="img-responsive" src="' + works[i] + '"></div>'); //THIS IS THE END PARENTHESIS FOR .APPEND()






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 26 at 16:57

























      answered Mar 26 at 16:51









      Ryan WilsonRyan Wilson

      4,5091 gold badge10 silver badges24 bronze badges




      4,5091 gold badge10 silver badges24 bronze badges







      • 1





        Not the down vote, but the use of `` is for escaping the new line, which can be a valid approach.

        – Taplar
        Mar 26 at 16:52











      • @Taplar Yeah, I realized that after I read a comment above and updated my answer, thanks for the information, I've never used that before, typically if I append to a string on multiple lines I just use the + sign at the end of a line

        – Ryan Wilson
        Mar 26 at 16:54












      • stackoverflow.com/questions/805107/…

        – j08691
        Mar 26 at 16:56











      • @Pete thanks, I missed that last one when editing.

        – Ryan Wilson
        Mar 26 at 16:57












      • 1





        Not the down vote, but the use of `` is for escaping the new line, which can be a valid approach.

        – Taplar
        Mar 26 at 16:52











      • @Taplar Yeah, I realized that after I read a comment above and updated my answer, thanks for the information, I've never used that before, typically if I append to a string on multiple lines I just use the + sign at the end of a line

        – Ryan Wilson
        Mar 26 at 16:54












      • stackoverflow.com/questions/805107/…

        – j08691
        Mar 26 at 16:56











      • @Pete thanks, I missed that last one when editing.

        – Ryan Wilson
        Mar 26 at 16:57







      1




      1





      Not the down vote, but the use of `` is for escaping the new line, which can be a valid approach.

      – Taplar
      Mar 26 at 16:52





      Not the down vote, but the use of `` is for escaping the new line, which can be a valid approach.

      – Taplar
      Mar 26 at 16:52













      @Taplar Yeah, I realized that after I read a comment above and updated my answer, thanks for the information, I've never used that before, typically if I append to a string on multiple lines I just use the + sign at the end of a line

      – Ryan Wilson
      Mar 26 at 16:54






      @Taplar Yeah, I realized that after I read a comment above and updated my answer, thanks for the information, I've never used that before, typically if I append to a string on multiple lines I just use the + sign at the end of a line

      – Ryan Wilson
      Mar 26 at 16:54














      stackoverflow.com/questions/805107/…

      – j08691
      Mar 26 at 16:56





      stackoverflow.com/questions/805107/…

      – j08691
      Mar 26 at 16:56













      @Pete thanks, I missed that last one when editing.

      – Ryan Wilson
      Mar 26 at 16:57





      @Pete thanks, I missed that last one when editing.

      – Ryan Wilson
      Mar 26 at 16:57













      3














      If you are in a position to use ES6, the template literal is here to remove the complexity/annoyance of multi-line string escaping.






      const works = ['http://placekitten.com/150/150', 'http://placekitten.com/200/200']

      for (let i = 0; i < works.length; ++i)
      $('#work').append(`
      <div class='col - sm '>
      <img class='img - responsive' src='$works[i]' alt=''>
      </div>
      `);
      ;

      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <div id="work"></div>








      share|improve this answer



























        3














        If you are in a position to use ES6, the template literal is here to remove the complexity/annoyance of multi-line string escaping.






        const works = ['http://placekitten.com/150/150', 'http://placekitten.com/200/200']

        for (let i = 0; i < works.length; ++i)
        $('#work').append(`
        <div class='col - sm '>
        <img class='img - responsive' src='$works[i]' alt=''>
        </div>
        `);
        ;

        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <div id="work"></div>








        share|improve this answer

























          3












          3








          3







          If you are in a position to use ES6, the template literal is here to remove the complexity/annoyance of multi-line string escaping.






          const works = ['http://placekitten.com/150/150', 'http://placekitten.com/200/200']

          for (let i = 0; i < works.length; ++i)
          $('#work').append(`
          <div class='col - sm '>
          <img class='img - responsive' src='$works[i]' alt=''>
          </div>
          `);
          ;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="work"></div>








          share|improve this answer













          If you are in a position to use ES6, the template literal is here to remove the complexity/annoyance of multi-line string escaping.






          const works = ['http://placekitten.com/150/150', 'http://placekitten.com/200/200']

          for (let i = 0; i < works.length; ++i)
          $('#work').append(`
          <div class='col - sm '>
          <img class='img - responsive' src='$works[i]' alt=''>
          </div>
          `);
          ;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="work"></div>








          const works = ['http://placekitten.com/150/150', 'http://placekitten.com/200/200']

          for (let i = 0; i < works.length; ++i)
          $('#work').append(`
          <div class='col - sm '>
          <img class='img - responsive' src='$works[i]' alt=''>
          </div>
          `);
          ;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="work"></div>





          const works = ['http://placekitten.com/150/150', 'http://placekitten.com/200/200']

          for (let i = 0; i < works.length; ++i)
          $('#work').append(`
          <div class='col - sm '>
          <img class='img - responsive' src='$works[i]' alt=''>
          </div>
          `);
          ;

          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          <div id="work"></div>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 17:02









          Andy HoffmanAndy Hoffman

          11.2k3 gold badges20 silver badges41 bronze badges




          11.2k3 gold badges20 silver badges41 bronze badges





















              1














              Take a look at the syntax highlight, you're closing the quotes and the interpreter is reading variables next to your string literals therefore throwing syntax errors, I'd encourage you to use ES6 Template literals or pay close attention to how you are using single and double quotes



              Try this



              for(var i = 0; i < works.length; ++i) 
              $('#work').append(`
              <div class='col-sm'>
              <img class='img-responsive' src='$works[i]>
              </div>
              `); //THIS IS THE END PARENTHESIS FOR .APPEND()
              ;





              share|improve this answer



























                1














                Take a look at the syntax highlight, you're closing the quotes and the interpreter is reading variables next to your string literals therefore throwing syntax errors, I'd encourage you to use ES6 Template literals or pay close attention to how you are using single and double quotes



                Try this



                for(var i = 0; i < works.length; ++i) 
                $('#work').append(`
                <div class='col-sm'>
                <img class='img-responsive' src='$works[i]>
                </div>
                `); //THIS IS THE END PARENTHESIS FOR .APPEND()
                ;





                share|improve this answer

























                  1












                  1








                  1







                  Take a look at the syntax highlight, you're closing the quotes and the interpreter is reading variables next to your string literals therefore throwing syntax errors, I'd encourage you to use ES6 Template literals or pay close attention to how you are using single and double quotes



                  Try this



                  for(var i = 0; i < works.length; ++i) 
                  $('#work').append(`
                  <div class='col-sm'>
                  <img class='img-responsive' src='$works[i]>
                  </div>
                  `); //THIS IS THE END PARENTHESIS FOR .APPEND()
                  ;





                  share|improve this answer













                  Take a look at the syntax highlight, you're closing the quotes and the interpreter is reading variables next to your string literals therefore throwing syntax errors, I'd encourage you to use ES6 Template literals or pay close attention to how you are using single and double quotes



                  Try this



                  for(var i = 0; i < works.length; ++i) 
                  $('#work').append(`
                  <div class='col-sm'>
                  <img class='img-responsive' src='$works[i]>
                  </div>
                  `); //THIS IS THE END PARENTHESIS FOR .APPEND()
                  ;






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 26 at 16:58









                  Gerardo SabettaGerardo Sabetta

                  264 bronze badges




                  264 bronze badges



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362288%2fthe-close-parenthesis-is-there-why-does-it-say-it-is-missing-the-parenthesis%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현