I'm trying to add a class to a bootstrap modal when a button is clicked. Nothing fancy except that there is only one modal which is populated with JSON content. To make my script working properly I need top add some identifier to the modal so the script knows which modal is open.
The modal looks like this:
<div data-show="false" data-width="800" tabindex="-1" aria-hidden="false" role="dialog" class="modal fade in" id="shop-modal">
    <div class="modal-dialog modal-lg">
      ... content from JSON ...
      </div> 
    </div> 
The modal is opened like this:
<a data-vid="123456" data-handle="link-to-product.html" class="trigger-cart" href=""></a>
 $('.trigger-cart').click(function(e){
    e.preventDefault();
    var $this = $(this);
    var url = $this.data('handle') + '/?format=json';
    var vid = $this.data('vid');
    quick_shop(url, vid);
  });
The function which is triggered on button click is this:
function quick_shop(url, vid){
  $('#shop-modal').addClass(vid);
$.getJSON(url, function (data){
  $('#shop-modal').modal('show');
   // do stuff....
What i try to do is to add vid as a class to the opened modal. As I tried with this $('#shop-modal').addClass(vid); I also tried stuff like this:
$('#shop-modal').modal('show').addClass(vid);
This doesn't work. Does anyone know how to do that?
 
     
    