/    Sign up×
Community /Pin to ProfileBookmark

Javascript help – fields appear/disappear with tick box and interacting fields

Hi I am a complete newbie so please go easy on me ?

I want to create an HTML form for a calculation and I want use javascript to perform the actual calcualtion on a button click. There are two things I want it to do but do not know if it is possible:

  • 1.

    I want to have a gross annual salary field and a gross weekly field, I also want a net annual and net weekly field. because some people only know what their annual salary is and not there weekly I want it to automatically complete they one they do not fill in. So if someone puts in their gross annual salary I want the gross weekly salary to automatically complete with (gross annual divided by 52). But if they put in their gross weekly I want it to automatically fill in their gross annual (weekly times 52). Is this possible?

  • 2.

    The second thing I want is that some of the text fields are optional so I want it to say ‘do you want to enter x’ with a tick box next to it, if it is ticked then I want the relevant text box/number box to appear.

  • Any help would be greatly appreciated ? Thank you

    to post a comment
    JavaScript

    1 Comments(s)

    Copy linkTweet thisAlerts:
    @cbVisionJan 14.2013 — Here's a basic example with jQuery:

    http://jsfiddle.net/3pdNf/5/
    ×

    Success!

    Help @tavyabe spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.16,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...