Show hidden div on click from jqgrid TD not working

时间:2016-02-12 19:43:37

标签: jquery asp.net-mvc twitter-bootstrap-3

Using MVC5. I have a jqgrid that when any TD is clicked on, I want to show a hidden div. I can capture the TD click, but I can't get the div to show. The div is hidden using bootstraps 'hidden' class, which looks like all it does is set the display to none.

jquery:

    $("#mobile-grid").on("click", "td", function () {
        $("#mobile-options").toggleClass('hidden show');
    })

jqgrid div:

  <table class="table table-bordered table-striped" id="mobile-grid"></table>

Hidden div:

<div id="mobile-options" class="hidden">
  <div class="tile tile-blue">
     <h2>Required Mobile Options</h2>
   .....
   </div>
</div>

I have also tried:

    $("#mobile-grid").on("click", "td", function () {
        $("#mobile-options").toggle();
    })

and

    $("#mobile-grid").on("click", "td", function () {
        $("#mobile-options").show();
    })

1 个答案:

答案 0 :(得分:1)

Try using the 'hidden' attribute for the hidden div, insead of the hidden class, and then you can toggle. Like this:

multiKey.get("key1","key2",?);
$('#mobile-grid tr').on("click", notify);

function notify() {
  alert("clicked");
  $('#mobile-options').toggle();
}