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

  • Home
  • SEARCH
  • 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 9255757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:46:55+00:00 2026-06-18T11:46:55+00:00

Here is a JSBin: http://jsbin.com/ofusec/2/ When you open the DIV (Customize or Personalize) the

  • 0

Here is a JSBin: http://jsbin.com/ofusec/2/

When you open the DIV (Customize or Personalize) the function acts as it should, truncate the “+” and replace with a “-” symbol, however when a user closes the DIV the string is duplicated and placed in.

I would like the closing to act the same as the opening (truncate and replace last character)

Here is the code:

HTML:

<div id="customize" class="leftDiv">
    <span class="smallTitle"  onclick="toggle_expand('customizePort');">Customize Portfolio &nbsp;&nbsp;&nbsp;&nbsp; +</span><br />
    <div class="leftDivContent" id="customizePort">
    LAYOUT:<BR />
    NAVIGATION:<BR />
    BACKGROUND COLOR:<BR />
    FONT COLOR:<BR />
    </div>
</div>

<div id="personalize" class="leftDiv">
    <span class="smallTitle" onclick="toggle_expand('personalizePort');">Personalize Portfolio &nbsp;&nbsp; +</span><br />
    <div class="leftDivContent" id="personalizePort">
        HEADER IMAGE:<BR />
        ARTIST STATEMENT:<br />
        CONTACT INFORMATION:<br />
    </div>
</div>

JAVASCRIPT:

function toggle_expand(id){
    var e = document.getElementById(id);
    var text = $(e).siblings().text();
    if( $(e).css('display') === 'none' ){
        $(e).slideToggle('fast', function(){
            var newText = text.replace("+","-");
            $(e).siblings().text( newText );
        });
    } else {
        $(e).slideToggle('fast', function(){
            var newText = text.replace("-","+");
            $(e).siblings().text( newText );
        });
    }
}
  • 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-18T11:46:56+00:00Added an answer on June 18, 2026 at 11:46 am

    this appears to have the effect you describe:

    function toggle_expand(id){
        var e = document.getElementById(id);
        var text = $(e).siblings("span").text();
        if( $(e).css('display') === 'none' ){
            $(e).slideToggle('fast', function(){
                var newText = $(e).siblings().text( text.slice(0, -1)+"-" );
            });
        } else {
            $(e).slideToggle('fast', function(){
                text = $(e).siblings("span").text( text.slice(0, -1)+"+" );
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Play with it here: http://jsbin.com/ocicu4/4/edit Simple Accordion, I only want one section open at
Please see my code here http://jsbin.com/ijoxa3/edit var drawHorizondalLine = function(x1,y1,x2,y2, color) { var width
I have this function (sample here: http://jsbin.com/emabe4/ ) var a=[]; var log = document.getElementById('log');
EDIT: See this in action here: http://jsbin.com/emobi/5 -- and that's using mouseenter/mouseleave. I have
Hi I have a code example available here: http://jsbin.com/oxoweh My problem is that I
I have a linechart here: http://jsbin.com/ugexag/1 You can see in the jsbin, when you
i have a website here is a jsbin http://jsbin.com/eqodep/1/ although jquery is not working
Possible Duplicate: JQuery change type of input field Demo here: http://jsbin.com/welcome/73795/edit <script src=http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js></script> <input
see example here http://jsbin.com/elesa code <p> <a target=_blank href=# title=Download PDF, 58KB, opens in
Please see this: http://jsbin.com/igeqa here, i am simply using alert ( tableObj.childNodes.length ); and

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.