Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 How do i hide and show div?

views
     
TSHejime
post Mar 19 2009, 01:38 PM, updated 17y ago

Getting Started
**
Junior Member
262 posts

Joined: Oct 2006
hi there...

say if there is a search page and there several textboxes and checkboxes and drop down list and so on

what i want to do is, by default the rows will be hidden or not visible using css style display

if user clicks on a specific row.. the textboxes will appear else if user

clicks on "Hide", the row will disappear again

it that possible to do in ASP.NET? for the first page, i'm using javascript

puaka_astro
post Mar 19 2009, 08:03 PM

Casual
***
Junior Member
331 posts

Joined: Jun 2007
From: Isketambola


try learning jquery, its much easy using jquery. here is some example on jquery. jquery is a javascript too,

CODE

<script type="text/javascript" src="/path/to/your/jquery.js"></script>
<script>
$(document).ready(function() {

    //trigger click event
   $('#myLinkId').click(function() {
        //this is eg. to show/hide your block
        $('#blockId').toggle();
   });

});
</script>

<body
[bad html removed] this can be anything(input,html tag), just assign the id to it -->
<input type="button" id="myLink" value="CLICK ME">

[bad html removed] this is your block to hide, assign the id -->

<div id="blockId" style="display:block; height:80px; width:80%;background:yellow;"> Hello Bro! Apa di atas? </div>

</body>



This post has been edited by puaka_astro: Mar 19 2009, 08:04 PM
Andrew Lim
post Mar 19 2009, 10:19 PM

Just keep on keeping on
*******
Senior Member
2,844 posts

Joined: Nov 2007


Ah, I didn't know you could use toggle to do it.
Currently I'm developing a similar application, but I'm using css( "display", "none" ) and css( "display", "inline" ) to achieve the effect.
puaka_astro
post Mar 20 2009, 12:35 AM

Casual
***
Junior Member
331 posts

Joined: Jun 2007
From: Isketambola


QUOTE(Andrew Lim @ Mar 19 2009, 10:19 PM)
Ah, I didn't know you could use toggle to do it.
Currently I'm developing a similar application, but I'm using css( "display", "none" ) and css( "display", "inline" ) to achieve the effect.
*
can too, toggle,show,hide can only switch between display:none/display:block. you will lose the "display:inline", instead you can use fadeIn() or fadeOut(), that will do the trick.
bubbliblu
post Mar 20 2009, 02:51 AM

Getting Started
**
Validating
127 posts

Joined: Oct 2008
use Document Object Model getElementById and some javascript onClick events
smile.gif
But JQuery is the best


 

Change to:
| Lo-Fi Version
0.0141sec    0.76    5 queries    GZIP Disabled
Time is now: 14th December 2025 - 09:02 AM