Here is my HTML
:
<div class='row sheet-row'>
<div class='col-sm-3'>Fruits</div>
<div class='col-sm-3'>
<button class='btn btn-primary' data-target='signup-52' data-toggle='modal'>Sign up</button>
</div>
<div class='col-sm-3'></div>
</div>
<div aria-hidden='true' aria-labelledby='Sign up' class='modal hide fade' id='signup-52' role='dialog' tabindex='-1'>
<div class='modal-header'>
<button aria-hidden='true' class='close' data-dismiss='modal' type='button'>×</button>
<h3 id='myModalLabel'>Sign up</h3>
</div>
<div class='modal-body'>
<p>One fine body…</p>
</div>
<div class='modal-footer'>
<button aria-hidden='true' class='btn' data-dismiss='modal'>Close</button>
<button class='btn btn-primary'>Save changes</button>
</div>
</div>
The button data-target
matches the modal id
yet when I click the button, nothing happens.
Any suggestions for troubleshooting would be appreciated. I have never implemented a modal, so it is likely a pretty basic oversight. I even tried changing aria-hidden
to false
in the modal to see if it would appear on initial page render, but it did not.
UPDATE
Thanks to @Guruprasad Rao
(answer below), I now have a working Fiddle
, but still not working code:
- View is in
HAML
- renders inHTML
. On button click, nothing happens. - I View Source, copy
HTML
for one button and one modal intoFiddle
. Fiddle
works perfectly with the same code which is not working on my site.