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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:39:33+00:00 2026-06-18T17:39:33+00:00

I have a field which obtains it input through a list of links associated

  • 0

I have a field which obtains it input through a list of links associated with numbers. (Similar to a calculator but without operators). I want to retrieve these numbers and put them through a function which divides them by 12. (A conversion from feet to inches).

First I have a list of jQuery click functions like this:

$('#a0').click(function(){
    writeInput(input, one); // var one = 1;
});

Next I have the function “write Input” (This is where the numbers are displayed on a “screen”)

enter image description here

function writeInput(field, str){
    $input = $(field);
    var text = $input.val($input.val() + str);
    $input.text(text);
    convert(text);
}

And lastly I have a function which is supposed to divide the number inputted by 12

function convert(input){
    var divide = (input / 12);
    $("#output").html(divide); //output is a paragraph where the number is displayed
}

When I run my code I am getting NAN output where the number should be. I have tried parseInt() and other tricks. But the closest I have come to something correct is when I got [object] [object] output.

Any help would be appreciated. Thanks!

  • 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-18T17:39:34+00:00Added an answer on June 18, 2026 at 5:39 pm

    In your code text is a jQuery object, you are using val as setter which returns a jQuery object, you should use val/text method as a getter for retrieving updated value.

    function writeInput(field, str){
        var text = $(field).val(function(i, v){
                      return v + str;
                   }).text(function(i, t){
                      return t + str
                   }).val();
        convert(text);
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input field which has a placeholder text. I want one word
i have an input field which will be displayed. i want that to hide
In my SharePoint List I have a custom field which is a filtered lookup.
I have a field which contains a string of numbers 2002 2005 2001 2006
I would like to have a field which is updated on every change(insertion, modification),
in my database we have a field which is going beyond int max value,
I use yui datatable and i have a field which is resumePath which is
I have a form field which requires a json object as its value when
I have a field 'Description' which can have product descriptions with any unicode characters.
Hi I have a text field which I would like to bind to a

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.