Outline ·
[ Standard ] ·
Linear+
How do i hide and show div?
|
TSHejime
|
Mar 19 2009, 01:38 PM, updated 17y ago
|
Getting Started

|
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
|
Mar 19 2009, 08:03 PM
|
|
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
|
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.
|
|
|
|
|
|
puaka_astro
|
Mar 20 2009, 12:35 AM
|
|
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
|
Mar 20 2009, 02:51 AM
|
Getting Started

|
use Document Object Model getElementById and some javascript onClick events  But JQuery is the best
|
|
|
|
|