Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-27
3
Medium Priority
?
310 Views
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">

</div>

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!
0
Comment
Question by:bbdesign
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 2000 total points
ID: 36712150
Something like this:

var tb = $("#abc input[class='organization']");
alert(tb.val());
0
 
LVL 6

Expert Comment

by:kswathi
ID: 36712181
Check the below links hope it helps

http://stackoverflow.com/questions/4088467/jquery-get-value-in-input-text-box
http://api.jquery.com/val/

or try

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

Open in new window

hope it helps.
0
 

Author Comment

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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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.
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

610 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