Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag 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>
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

Avatar of Larry Brister

ASKER

Thanks
You are welcome.