JavaScript - ..Need to make the visible button through jquery.

Asked By shah zeb on 27-Dec-11 05:35 AM
Hi,

I have button in my Asp.Net page, who's display property i have set to false.
I need to make it visible in. how to do that i have tried the below methods but no gains.


// $('#btnDetail').show();

// $('#btnDetail').attr("Visible", true);


How can i acheive this?
Regards,
Web Star replied to shah zeb on 27-Dec-11 05:38 AM
Try this way to hide/show of button based on text input

$("textarea").keyup(function() {
 
if ($(this).val().replace(/ /g, '') == '')
    $
("#id-of-button").show();  
 
else
    $
("#id-of-button").hide();
})
shah zeb replied to Web Star on 27-Dec-11 05:49 AM
Not working...
smr replied to shah zeb on 27-Dec-11 05:52 AM
hi

To change visibility, you need to use http://api.jquery.com/css/, like this:

$("#elem").css('visibility', 'visible');

 

Unless you need to have the element occupy page space though, use display: none; instead of visibility: hidden; in your CSS, then just do:

$("#elem").show();

The http://api.jquery.com/show/ and http://api.jquery.com/hide/ functions deal with display instead of visibility, like most of the jQuery functions :)


follow
http://stackoverflow.com/questions/3025246/how-can-i-visible-an-invisible-control-with-jquery-hide-and-show-not-work
http://api.jquery.com/visible-selector/
dipa ahuja replied to shah zeb on 27-Dec-11 05:58 AM
<div class="detailDiv">
This is example of Hide show div element using jquery 
</div>

<button class="button">Show or Hide div </button>

 
 <script type="text/javascript">
 
   $(document).ready(function () {
 
     $(".detailDiv").hide();
     $('.button').click(function () {
       $(".detailDiv").slideToggle();
     });
 
   });
 
</script>