quilkin
quilkin

Reputation: 1427

Confused about bootstrap and jquery versions

I'm trying to implement a stateful button as described here but it wouldn't work, so I tried on jsfiddle. Choosing jquery 1.11.0 and loading in the bootstrap external resources, it works. But if (in jsfiddle) I change to jquery 2.0.2 it stops working; the button state does not change. If I go on to jquery 2.1.0 it works again. Also tried in Bootply but that doesn't offer jquery 1.11.0 or 2.1.0, so my code doesn't work there either.

<button id="getWebData" type="button" class="btn btn-primary pull-right " data-loading-text="Loading...">Get data</button>

 $("#getWebData").on('click',function() {
   var $btn = $(this).button('loading');
   // bleData.GetWebData($btn);
 })

So I could change my code to use jquery 2.1.0 but then it won't work with IE8 (maybe that doesn't matter). And I can see from jsfiddle that it should work with 1.11.0

Upvotes: 0

Views: 92

Answers (2)

quilkin
quilkin

Reputation: 1427

Actually it does work with Jquery 1.11.0. I had forgotten to allow the DOM to update the button:

        $("#getWebData").on('click',function() {
        var $btn = $(this).button('loading');
        setTimeout(function () {
             bleData.GetWebData($btn);
        }, 100);

so it was resetting the original button after the json call in GetWebData(), and never had a chance to display the modified button. Anyway, it does appear from my jsfiddle that the stateful button does not work with jquery 2.0.1

Upvotes: 0

Dimas Pante
Dimas Pante

Reputation: 2521

jQuery doesn't support IE8 since version 2.x (Source: http://blog.jquery.com/2013/04/18/jquery-2-0-released/).

You can try using a fallback like this:

<!--[if (!IE)|(gt IE 8)]><!-->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<!--<![endif]-->

<!--[if lte IE 8]>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<![endif]-->

Source: https://gist.github.com/dwoodiwiss/5633393

Upvotes: 1

Related Questions