tags:

views:

63

answers:

5

I have page with 3 textbox. I to find all textboxes which have value into it and print its text. How to do?

A: 
$('input').each(function(){
    alert(this.value);
});
inkedmn
+1  A: 

I gess that you need either

$("input[type=text]").val();

or

$("textarea").val();

Most likely, you will need both, so

$("input[type=text][value!=] textarea[value!=]").val();

would search the contents of all non empty elements on your page a user can insert text into.

voyager
A: 

Use selector/text and selectors/attributeNotEqual.

$("form input:text[value!=]").each(function() {
  $(this).val();
});
ranonE
+3  A: 

This is the code to fetch all the values of the in a page which are not empty:

$('input[type=text][value!=]').each( function() { 
    var value = $(this).val();
    // do whatever you want with the value
});
Keeper
Thankyou it will worked!
Mario
A: 
$(':text').each(function() {
    alert(this.value);
});
nickf