Search This Blog

Showing posts with label Jquery button visibility on/off in ASP.NET MVC. Show all posts
Showing posts with label Jquery button visibility on/off in ASP.NET MVC. Show all posts

Thursday, February 20, 2014

JQuery Set Visibility ON/OFF for a Button in ASP.NET MVC

How to Make a Button Visible true or False of a button in ASP.NET MVC project

I posted the same solution on stackoverflow site

First Method: As explained above, but I am afraid, it will not work if for example you have a partial view and based on something there you want to show or hide something.
Second Method:Initial Page load, button is visible.
<input id='btnAdd' type='button' value='Add' style='display:block;'/>
Based on some action on page/partial view
<script>
  function disableAdd() {
  $('#btnAdd').hide();
}
</script>
*Please note, jquery will not be able to hide/show if you use visibility in style sheet.