Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7848501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:13:37+00:00 2026-06-02T18:13:37+00:00

fairly new to jQuery so bear with me. I am having trouble getting the

  • 0

fairly new to jQuery so bear with me.

I am having trouble getting the results of one function over to another an executing it.

Then the point is to pass the text as a var to the function populateMessage() and it writes the text to a text box.

I can get the text and it does get passed to the populateMessage function but the function never fully executes and the text box is not populated. If I wrap the populateMessage function in document.ready and have it write something like .text(‘test’); it will work.

How can I make this work?

Thanks for the help

$(document).ready(function () {
    getClickedInvite();
});

//gets clicked item template and sends it to message box

function getClickedInvite() {
    $('.card').click(function () {
        var selectedMessage = $(this).text();
        alert(selectedMessage);
        populateMessage(selectedMessage);
    });
}

function populateMessage(selectedMessage) { 
    alert(selectedMessage + ' has been sent to the message box ')
    var inviteMessageBoxId = $('#inviteMessageBox').find('textarea').attr('id');
    alert(inviteMessageBoxId);
    $('#' + inviteMessageBoxId).text(selectedMessage);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:13:39+00:00Added an answer on June 2, 2026 at 6:13 pm

    There is no need to extend the function like that. And if you read the manual, it says

    Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.

    SO .find() always does not return a single element.

    $('#inviteMessageBox').find('textarea')[0].text(selectedMessage);
    

    Or, if getting id is really that necessary then

    var id = $('#inviteMessageBox').find('textarea')[0].attr('id');
    $("#"+id").text(selectedMessage);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fairly new to jQuery and I'm having trouble with an animation that I'd
I'm fairly new to jquery and working with json, so please bear with me.
Fairly new to Jquery here.... but one thing I have been told and being
I'm fairly new to jQuery and just started working with jqGrid. I've looked over
I'm fairly new to ASP.NET MVC, and I'm having a little trouble with scripts...
I fairly new to JQuery and perhaps trying to achieve something that might be
I'm fairly new to jQuery and I've been looking for a decent free datepicker
I'm fairly new to JQuery and for some reason I can't get the currently
I'm fairly new to JQuery and I'm trying to add multiple form fields for
I am fairly new to jquery and I am working with jsp and struts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.