Onclick text populates both textareasjQuery get textarea textTrigger a button click with JavaScript on the Enter key in a text boxjQuery get specific option tag textHTML text input allow only numeric inputGet selected text from a drop-down list (select box) using jQueryGet the value in an input text boxjQuery.click() vs onClickCreating textarea and buttons dynamicallyjQuery - show edit textarea form when link is clicked and hide paragraphHow to use correctly document.querySelectorAll

How do I request a longer than normal leave of absence period for my wedding?

Are the players on the same team as the DM?

Why isn't "I've" a proper response?

Why in most German places is the church the tallest building?

How to find out the average duration of the peer-review process for a given journal?

Is immersion of utensils (tevila) valid before koshering (hagala)?

Would the Republic of Ireland and Northern Ireland be interested in joining together?

Best clipless pedals for sore feet?

Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?

State-of-the-art algorithms for solving linear programming problems

Would this system work to purify water?

How is the idea of "two people having a heated argument" idiomatically expressed in German?

Sitecore PowerShell script to get all images where the File Path is empty

Which note goes on which side of the stem?

Can a Rogue PC teach an NPC to perform Sneak Attack?

Why do banks “park” their money at the European Central Bank?

Do they have Supervillain(s)?

Identify a problem where a potentially winning move draws because of the 50 move rule

Justifying the use of directed energy weapons

Is gzip atomic?

Dealing with an extrovert co-worker

Was there ever a treaty between 2 entities with significantly different translations to the detriment of one party?

Architectural feasibility of a tiered circular stone keep

Avoiding racist tropes in fantasy



Onclick text populates both textareas


jQuery get textarea textTrigger a button click with JavaScript on the Enter key in a text boxjQuery get specific option tag textHTML text input allow only numeric inputGet selected text from a drop-down list (select box) using jQueryGet the value in an input text boxjQuery.click() vs onClickCreating textarea and buttons dynamicallyjQuery - show edit textarea form when link is clicked and hide paragraphHow to use correctly document.querySelectorAll






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








0















I have a number of textareas and when I click on a paragraph outside the text is supposed to be added to the textarea, it works but the text is also getting added to the textareas above.



I'm a bit stumped on why this is happening and as I have 10 textaraes so clicking a paragraph at the bottom of the page adds the text to all the other textareas above.



Javascript



$(document).ready(function () 
$("#PollutionPreventionDivScrollDisplay").hide();

$("#PollutionPreventionDivScroll").on("click", function ()
$("#PollutionPreventionDivScrollDisplay").toggle();
);

var cartlist = document.querySelector("#EnvironmentalActionPollutionPreventionIdeasForAction");
var items = document.querySelectorAll("[data-item]");

[].forEach.call(items, function (item)
item.addEventListener("click", function (e)
e.preventDefault();
cartlist.value += `n$item.innerHTML`;
);
);
);
$(document).ready(function ()
$("#WasteDivScrollDisplay").hide();

$("#WasteDivScrollDisplayScroll").on("click", function ()
$("#WasteDivScrollDisplay").toggle();
);

var cartlistOne = document.querySelector("#EnvironmentalActionWasteManagementIdeasForAction");
var itemsOne = document.querySelectorAll("[data-item]");

[].forEach.call(itemsOne,
function (itemOne)
itemOne.addEventListener("click", function (e)
e.preventDefault();
cartlistOne.value += `n$itemOne.innerHTML`;
);
);
);
$(document).ready(function ()
$("#EnergyDivScrollDisplay").hide();

$("#EnergyDivScrollDisplayScroll").on("click", function ()
$("#EnergyDivScrollDisplay").toggle();
);

var cartlistTwo = document.querySelector("#EnvironmentalActionEnergyIdeasForAction");
var itemsTwo = document.querySelectorAll("[data-item]");

[].forEach.call(itemsTwo,
function (itemTwo)
itemTwo.addEventListener("click", function (c)
c.preventDefault();
cartlistTwo.value += `n$itemTwo.innerHTML`;
);
);
);


Example of html



<div class="row">
<div id="PollutionPreventionDivScrollDisplay" class="col-md-12 border-colour fixed-height">
@foreach (var info in Model.EnvironmentalActionPollutionPreventionExtraInfo)

var countItems = counter++;
<p><a data-item="@countItems" href="#">@info</a></p>

</div>
</div>

<div class="col-md-4 border-colour-right">
<div class="form-group">
<span class="mouse-pointer text-danger" id="PollutionPreventionDivScroll">Click to add options</span>
<label class="sr-only" for="EnvironmentalActionPollutionPreventionIdeasForActionPlaceholder">Environmental Action Pollution Prevention Ideas For Action</label>
@Html.TextAreaFor(x => x.EnvironmentalActionPollutionPreventionIdeasForAction, new Class = "form-control", Placeholder = Model.EnvironmentalActionPollutionPreventionIdeasForActionPlaceholder, rows = "8" )
</div>
</div>


All other code is the same except the sames are different










share|improve this question






























    0















    I have a number of textareas and when I click on a paragraph outside the text is supposed to be added to the textarea, it works but the text is also getting added to the textareas above.



    I'm a bit stumped on why this is happening and as I have 10 textaraes so clicking a paragraph at the bottom of the page adds the text to all the other textareas above.



    Javascript



    $(document).ready(function () 
    $("#PollutionPreventionDivScrollDisplay").hide();

    $("#PollutionPreventionDivScroll").on("click", function ()
    $("#PollutionPreventionDivScrollDisplay").toggle();
    );

    var cartlist = document.querySelector("#EnvironmentalActionPollutionPreventionIdeasForAction");
    var items = document.querySelectorAll("[data-item]");

    [].forEach.call(items, function (item)
    item.addEventListener("click", function (e)
    e.preventDefault();
    cartlist.value += `n$item.innerHTML`;
    );
    );
    );
    $(document).ready(function ()
    $("#WasteDivScrollDisplay").hide();

    $("#WasteDivScrollDisplayScroll").on("click", function ()
    $("#WasteDivScrollDisplay").toggle();
    );

    var cartlistOne = document.querySelector("#EnvironmentalActionWasteManagementIdeasForAction");
    var itemsOne = document.querySelectorAll("[data-item]");

    [].forEach.call(itemsOne,
    function (itemOne)
    itemOne.addEventListener("click", function (e)
    e.preventDefault();
    cartlistOne.value += `n$itemOne.innerHTML`;
    );
    );
    );
    $(document).ready(function ()
    $("#EnergyDivScrollDisplay").hide();

    $("#EnergyDivScrollDisplayScroll").on("click", function ()
    $("#EnergyDivScrollDisplay").toggle();
    );

    var cartlistTwo = document.querySelector("#EnvironmentalActionEnergyIdeasForAction");
    var itemsTwo = document.querySelectorAll("[data-item]");

    [].forEach.call(itemsTwo,
    function (itemTwo)
    itemTwo.addEventListener("click", function (c)
    c.preventDefault();
    cartlistTwo.value += `n$itemTwo.innerHTML`;
    );
    );
    );


    Example of html



    <div class="row">
    <div id="PollutionPreventionDivScrollDisplay" class="col-md-12 border-colour fixed-height">
    @foreach (var info in Model.EnvironmentalActionPollutionPreventionExtraInfo)

    var countItems = counter++;
    <p><a data-item="@countItems" href="#">@info</a></p>

    </div>
    </div>

    <div class="col-md-4 border-colour-right">
    <div class="form-group">
    <span class="mouse-pointer text-danger" id="PollutionPreventionDivScroll">Click to add options</span>
    <label class="sr-only" for="EnvironmentalActionPollutionPreventionIdeasForActionPlaceholder">Environmental Action Pollution Prevention Ideas For Action</label>
    @Html.TextAreaFor(x => x.EnvironmentalActionPollutionPreventionIdeasForAction, new Class = "form-control", Placeholder = Model.EnvironmentalActionPollutionPreventionIdeasForActionPlaceholder, rows = "8" )
    </div>
    </div>


    All other code is the same except the sames are different










    share|improve this question


























      0












      0








      0








      I have a number of textareas and when I click on a paragraph outside the text is supposed to be added to the textarea, it works but the text is also getting added to the textareas above.



      I'm a bit stumped on why this is happening and as I have 10 textaraes so clicking a paragraph at the bottom of the page adds the text to all the other textareas above.



      Javascript



      $(document).ready(function () 
      $("#PollutionPreventionDivScrollDisplay").hide();

      $("#PollutionPreventionDivScroll").on("click", function ()
      $("#PollutionPreventionDivScrollDisplay").toggle();
      );

      var cartlist = document.querySelector("#EnvironmentalActionPollutionPreventionIdeasForAction");
      var items = document.querySelectorAll("[data-item]");

      [].forEach.call(items, function (item)
      item.addEventListener("click", function (e)
      e.preventDefault();
      cartlist.value += `n$item.innerHTML`;
      );
      );
      );
      $(document).ready(function ()
      $("#WasteDivScrollDisplay").hide();

      $("#WasteDivScrollDisplayScroll").on("click", function ()
      $("#WasteDivScrollDisplay").toggle();
      );

      var cartlistOne = document.querySelector("#EnvironmentalActionWasteManagementIdeasForAction");
      var itemsOne = document.querySelectorAll("[data-item]");

      [].forEach.call(itemsOne,
      function (itemOne)
      itemOne.addEventListener("click", function (e)
      e.preventDefault();
      cartlistOne.value += `n$itemOne.innerHTML`;
      );
      );
      );
      $(document).ready(function ()
      $("#EnergyDivScrollDisplay").hide();

      $("#EnergyDivScrollDisplayScroll").on("click", function ()
      $("#EnergyDivScrollDisplay").toggle();
      );

      var cartlistTwo = document.querySelector("#EnvironmentalActionEnergyIdeasForAction");
      var itemsTwo = document.querySelectorAll("[data-item]");

      [].forEach.call(itemsTwo,
      function (itemTwo)
      itemTwo.addEventListener("click", function (c)
      c.preventDefault();
      cartlistTwo.value += `n$itemTwo.innerHTML`;
      );
      );
      );


      Example of html



      <div class="row">
      <div id="PollutionPreventionDivScrollDisplay" class="col-md-12 border-colour fixed-height">
      @foreach (var info in Model.EnvironmentalActionPollutionPreventionExtraInfo)

      var countItems = counter++;
      <p><a data-item="@countItems" href="#">@info</a></p>

      </div>
      </div>

      <div class="col-md-4 border-colour-right">
      <div class="form-group">
      <span class="mouse-pointer text-danger" id="PollutionPreventionDivScroll">Click to add options</span>
      <label class="sr-only" for="EnvironmentalActionPollutionPreventionIdeasForActionPlaceholder">Environmental Action Pollution Prevention Ideas For Action</label>
      @Html.TextAreaFor(x => x.EnvironmentalActionPollutionPreventionIdeasForAction, new Class = "form-control", Placeholder = Model.EnvironmentalActionPollutionPreventionIdeasForActionPlaceholder, rows = "8" )
      </div>
      </div>


      All other code is the same except the sames are different










      share|improve this question














      I have a number of textareas and when I click on a paragraph outside the text is supposed to be added to the textarea, it works but the text is also getting added to the textareas above.



      I'm a bit stumped on why this is happening and as I have 10 textaraes so clicking a paragraph at the bottom of the page adds the text to all the other textareas above.



      Javascript



      $(document).ready(function () 
      $("#PollutionPreventionDivScrollDisplay").hide();

      $("#PollutionPreventionDivScroll").on("click", function ()
      $("#PollutionPreventionDivScrollDisplay").toggle();
      );

      var cartlist = document.querySelector("#EnvironmentalActionPollutionPreventionIdeasForAction");
      var items = document.querySelectorAll("[data-item]");

      [].forEach.call(items, function (item)
      item.addEventListener("click", function (e)
      e.preventDefault();
      cartlist.value += `n$item.innerHTML`;
      );
      );
      );
      $(document).ready(function ()
      $("#WasteDivScrollDisplay").hide();

      $("#WasteDivScrollDisplayScroll").on("click", function ()
      $("#WasteDivScrollDisplay").toggle();
      );

      var cartlistOne = document.querySelector("#EnvironmentalActionWasteManagementIdeasForAction");
      var itemsOne = document.querySelectorAll("[data-item]");

      [].forEach.call(itemsOne,
      function (itemOne)
      itemOne.addEventListener("click", function (e)
      e.preventDefault();
      cartlistOne.value += `n$itemOne.innerHTML`;
      );
      );
      );
      $(document).ready(function ()
      $("#EnergyDivScrollDisplay").hide();

      $("#EnergyDivScrollDisplayScroll").on("click", function ()
      $("#EnergyDivScrollDisplay").toggle();
      );

      var cartlistTwo = document.querySelector("#EnvironmentalActionEnergyIdeasForAction");
      var itemsTwo = document.querySelectorAll("[data-item]");

      [].forEach.call(itemsTwo,
      function (itemTwo)
      itemTwo.addEventListener("click", function (c)
      c.preventDefault();
      cartlistTwo.value += `n$itemTwo.innerHTML`;
      );
      );
      );


      Example of html



      <div class="row">
      <div id="PollutionPreventionDivScrollDisplay" class="col-md-12 border-colour fixed-height">
      @foreach (var info in Model.EnvironmentalActionPollutionPreventionExtraInfo)

      var countItems = counter++;
      <p><a data-item="@countItems" href="#">@info</a></p>

      </div>
      </div>

      <div class="col-md-4 border-colour-right">
      <div class="form-group">
      <span class="mouse-pointer text-danger" id="PollutionPreventionDivScroll">Click to add options</span>
      <label class="sr-only" for="EnvironmentalActionPollutionPreventionIdeasForActionPlaceholder">Environmental Action Pollution Prevention Ideas For Action</label>
      @Html.TextAreaFor(x => x.EnvironmentalActionPollutionPreventionIdeasForAction, new Class = "form-control", Placeholder = Model.EnvironmentalActionPollutionPreventionIdeasForActionPlaceholder, rows = "8" )
      </div>
      </div>


      All other code is the same except the sames are different







      javascript jquery






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 17:28









      George PhillipsonGeorge Phillipson

      4316 silver badges29 bronze badges




      4316 silver badges29 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0















          Ok silly mistake, I had all 'data-item' the same should have been 'data-item-one', 'data-item-two' etc






          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%2f55383271%2fonclick-text-populates-both-textareas%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0















            Ok silly mistake, I had all 'data-item' the same should have been 'data-item-one', 'data-item-two' etc






            share|improve this answer





























              0















              Ok silly mistake, I had all 'data-item' the same should have been 'data-item-one', 'data-item-two' etc






              share|improve this answer



























                0














                0










                0









                Ok silly mistake, I had all 'data-item' the same should have been 'data-item-one', 'data-item-two' etc






                share|improve this answer













                Ok silly mistake, I had all 'data-item' the same should have been 'data-item-one', 'data-item-two' etc







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 27 at 19:17









                George PhillipsonGeorge Phillipson

                4316 silver badges29 bronze badges




                4316 silver badges29 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    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%2f55383271%2fonclick-text-populates-both-textareas%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권, 지리지 충청도 공주목 은진현