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 7168981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:53:34+00:00 2026-05-28T14:53:34+00:00

can anyone explain me what happen here?? i have this html code: <div class=calculadora>

  • 0

can anyone explain me what happen here??

i have this html code:

   <div class="calculadora">

      <div class="clear campos">
       <label>Amount</label>
       <input class="fi" id="amount" type="text" name="amount" value=""/>
      </div>

      <div class="clear campos">
       <label>Down Payment</label>
       <input class="fi" id="downPay" type="text" name="downPay" value=""/>
      </div>

      <div class="clear campos">
       <label>Years</label>
       <input class="fi" id="years" type="text" name="years" value=""/>
      </div>

      <div class="clear campos">
       <label>Rate</label>
       <input class="fi" id="rate" type="text" name="rate" value=""/>
      </div>

      <input id="cal" type="button" value="cacular"/>
      <div class="result"></div>
          </div>

And i’m making a jquery plugin, but i need to get all the attr(‘value’) of each input, and i´m doing this way:

this.each(function(){

        var obj = $(this),
        vacio = parseFloat( $('.fi', obj).attr('value'));

       // some code...

But what happens it’s that only get the first value of the first input… why??

BUT!! if i make this way :

var s = $('.fi', obj).each(function(){
             alert ($(this).attr('value'))
            });

it workss!!! Why?? this is good???

Tks in advance if anyone can explain to me.

  • 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-05-28T14:53:35+00:00Added an answer on May 28, 2026 at 2:53 pm

    .attr() returns the value of the specified attirbute from the first element in the collection is called upon.

    From the doc:

    Get the value of an attribute for the first element in the set of matched elements.

    When you make it the other way, you are extracting the value attribute data for each element in the matched set.

    One way to achieve what you’re after could be done by using the .map() function, which returns a jquery array:

    var vals = $('.fi', obj).map(function(){
        return this.value;
    });
    

    To transform it to a pure javascript array, you use vals.toArray();

    Note: no need for jquery to get the value of an input because this in event handlers and in iteration on elements is the current DOMElement, so you can just do this.value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone explain what this mod_rewrite rule is doing? I'm trying to comment the
Can anyone explain why following code won't compile? At least on g++ 4.2.4. And
Can anyone explain to me what this means? Run-Time Check Failure #0 - The
Can anyone help me explain how TimeProvider.Current can become null in the following class?
Can anyone explain to me why the following code doesn't work within a function
Can anyone explain what advantages there are to using a tool like MSBuild (or
Can anyone explain in simple words what First and Second Level caching in Hibernate/NHibernate
Can anyone explain the difference between Server.MapPath(.) , Server.MapPath(~) , Server.MapPath(@\) and Server.MapPath(/) ?
Can anyone explain the meaning of and purposes of the values for the SecurityAction
Can anyone explain the differences between Protocols and Categories in Objective-C? When do you

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.