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;
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
add a comment |
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
add a comment |
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
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
javascript jquery
asked Mar 27 at 17:28
George PhillipsonGeorge Phillipson
4316 silver badges29 bronze badges
4316 silver badges29 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Ok silly mistake, I had all 'data-item' the same should have been 'data-item-one', 'data-item-two' etc
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Ok silly mistake, I had all 'data-item' the same should have been 'data-item-one', 'data-item-two' etc
add a comment |
Ok silly mistake, I had all 'data-item' the same should have been 'data-item-one', 'data-item-two' etc
add a comment |
Ok silly mistake, I had all 'data-item' the same should have been 'data-item-one', 'data-item-two' etc
Ok silly mistake, I had all 'data-item' the same should have been 'data-item-one', 'data-item-two' etc
answered Mar 27 at 19:17
George PhillipsonGeorge Phillipson
4316 silver badges29 bronze badges
4316 silver badges29 bronze badges
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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