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. This is a piece of code from using sqlite in android tutorial: return
Everyone, every blog is talking about HTML 5 and giving solution to use HTML
everyone. I am an experienced C programmer trying to get adjusted to C++. I
Everyone who's done any web application development in Scala knows that you can use
everyone. Firstly, forgive my poor English #_# I use ubuntu 11.10 now. And I
everyone Background: I am using phpmailer to send emails. For a group of users
everyone , I have a problem about the API-- alSourceUnqueueBuffers when I use the
everyone, I have some question about C++, what do You actually prefer to use
everyone. I have problem replacing existing rows in table with new ones. I use

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.