get values of text boxes, by class, within a DIV where I know ID of DIV

Posted on 2011-09-27
Last Modified: 2012-05-12
I have text boxes like this:

<input type="text" class="organization" size="32">

They are buried a few levels down beneath a DIV, such as:

<div id="abc">


In my script, I know the ID of the DIV. I need to get what is typed into the text box by class. There will be only one "organization" class within each DIV.

The text box is not a direct child of the DIV, which is where I'm getting a little confused.

Thank you!
Question by:bbdesign
LVL 41

Accepted Solution

guru_sami earned 500 total points
ID: 36712150
Something like this:

var tb = $("#abc input[class='organization']");

Expert Comment

ID: 36712181
Check the below links hope it helps

or try

$('.organization').keyup(function(e) {
  var $input = $(this);
    var value = $input.val();

Open in new window

hope it helps.

Author Comment

ID: 36712282
That worked, with the exception that I just needed to add val() to the end. Thanks!

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question