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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:02:30+00:00 2026-05-23T17:02:30+00:00

everyone. I’m trying to use an a href link to onclick toggle unhide and

  • 0

everyone.

I’m trying to use an a href link to “onclick” toggle unhide and hide. I’ve tried using jQuery, javascript functions, but I just don’t seem to know quite enough to make it work. I’ve gotten close. This is what I have now (my 8th or so attempt)

styles.css:

.noPhones{
    display: none;
}

The javascript (contacts.tpl):

{literal}
<script type="text/javascript">
function swapMyToggledDiv()
{
if(document.getElementById(".noPhones").style.display == "none")
{
document.getElementById(".noPhones").style.display = "block";
}
else
{
document.getElementById(".noPhones").style.display = "none";
}</script>
{/literal}

My forms (contacts.tpl):

        <tr><td>
            <h2><a href="#" onclick="swapMyToggledDiv()">Phone</a></h2>
        </td><td>
            <input type="hidden" name="phone[contactId]" value="{$userData.contact_id}" />
            <input type="text" name="phone[tel]" size="25" value="{$userData.telTel}" />
        </td></tr>

        <tr class="noPhones"><td>
            <h2>Cell #</h2>
        </td><td>
            <input type="text" name="phone[cell]" size="25" value="{$userData.telCell}" />
        </td></tr>

        <tr class="noPhones"><td>
            <h2>Work #</h2>
        </td><td>
            <input type="text" name="phone[work]" size="25" value="{$userData.telWork}" />
        </td></tr>

        <tr class="noPhones"><td>
            <h2>Home #</h2>
        </td><td>
            <input type="text" name="phone[home]" size="25" value="{$userData.telHome}" />
        </td></tr>

        <tr class="noPhones"><td>
            <h2>Pager #</h2>
        </td><td>
            <input type="text" name="phone[pager]" size="25" value="{$userData.telPager}" />
        </td></tr>

        <tr class="noPhones"><td>
            <h2>Fax</h2>
        </td><td>
            <input type="text" name="phone[fax]" size="25" value="{$userData.telFax}" />
        </td></tr>

I need all the rows with class “noPhones” hidden until clicking the link.

Any help will be greatly 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-05-23T17:02:30+00:00Added an answer on May 23, 2026 at 5:02 pm

    Toggling visibility in jQuery is straightforward:

    function swapMyToggledDiv()
    {
        $( ".noPhones" ).toggle();
    }
    

    If you apply an ID to your link, you can apply this action in the jQuery onready method:

    $( function() {
        $( "#toggle_link" ).click( function() {
            $( ".noPhones" ).toggle();
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

everyone. I'm trying to get data from some page, it's updated using javascript. First,
Everyone in my office uses Macs and therefore most use Safari. We have a
Greetings Everyone I am new in asp.net and i'm using RadControls for Asp.net Ajax
Everyone, I have really tried, but I can't find out how to upload photos
everyone! I'm trying to send mail in ASP.NET web-site. I have smtp configuration section
Everyone use lot of List. I need to iterate over this list, so I
everyone the question is how to use options Show windows side by side by
Everyone I am using C#.NET for the task. Let me explain briefly what i
everyone. I am trying to create a database in which I can store pictures
Everyone knows, if you want to thread emails you use Jamie Zawinski's algorithm .

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.