change text based on selection

I have the following form:

                              <tr style='display:none'>
                                    <td>select page type:</td>
                                          <input type="radio" name="pageType" value="1">type1<br>
                                          <input type="radio" name="pageType" value="2">type2<br>
                                          <input type="radio" name="pageType" value="3">type3<br>
                                          <input type="radio" name="pageType" value="4">type4<br>
                                    <td id="cat"></td>
                                    <td><input type="text" name="maxItems" size="3"></td>
                                    <td colspan="2">      
                                          <input type="submit" value="submit" name="submit">

I want to set the "cat" cell based on "pageType" selection using jquery.
Now -
1) Each selection should render different text ("follow up1","follow up2"...)
2) You cannot put the required texts inside the value or as the displayed value of the radio buttons.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
you might use a JSON object for the display texts.
var displayTexts = {
    "1" : "Wow 1",
    "2" : "Hola 2",
    "3" : "Other three",
    "4" : "Fantastic Four"
$(document).ready(function() {
    $('input[name="pageType"]').on('change', function() {

Open in new window

Live sample:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
arielbfAuthor Commented:
I see in your live example that it is working.
But in my page for some reason - it is not working.
Any ideas?
Rainer JeschorCommented:
please verify
- that the onChange handler is called
- that the input name for the selector is correct
- that you have created the display text JSON as global variable (outside of the document.ready handler)
Have you verified using Chrome or IE Dev Tools that there is no script error?
Without the full page code or a link to the page it is really hard to guess whats going wrong.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.