Avatar of Larry Brister
Larry Brister
Flag for United States of America asked on

toggle div tag javascript

I need a simple script to toggle a div tag on and off on an onclick link event

And please tell me where to place the script.
In a scrip section in the head of the page or at the bottom of the page

I currently have this

<style type="text/css">
        .eAddress {
            height: 60px;
            line-height: 60px;
            text-align: left;
            color: #8898AA;
            font-weight: bold;
            padding-left: 50px;
            width: 100%;
            display: none;
            clear: left;
        }
    </style>

<div id="divEditAddress" class="eAddress">TEST</div>
<div class="btAddress"><button id="btnAddress">Edit Address</button></div>
.NET ProgrammingHTMLJavaScript

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Julian Hansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Miguel Oz

Use jquery toggle at scrip section  bottom of the page:
http://api.jquery.com/toggle/
<script>
$('#yourLinkId').on('click', function(){
	var targetDiv = $('#divEditAddress').toggle();;
});
</script>

Open in new window

Larry Brister

ASKER
Thanks
Julian Hansen

You are welcome.
Your help has saved me hundreds of hours of internet surfing.
fblack61