How do I filter the returned data from jQuery.ajax()?

The use of filter() vs. find() depends on the structure of your retrieved HTML page. For example, if this is the retrieved page: <!DOCTYPE html> <html> <head> <title>Foo</title> </head> <body> <div id=”wrap”> <div id=”header”> <h1>Foo</h1> </div> <div id=”body”> content </div> </div> <div id=”tooltip”> tooltip </div> </body> </html> If you want to select the top-level elements … Read more

Limit bootstrap-datepicker to weekdays only?

The latest version from https://github.com/eternicode/bootstrap-datepicker already has an option to disable selection of particular weekdays. From the docs: daysOfWeekDisabled String, Array. Default: ‘’, [] Days of the week that should be disabled. Values are 0 (Sunday) to 6 (Saturday). Multiple values should be comma-separated. Example: disable weekends: ‘0,6’ or [0,6]. In other words, just instantiate … Read more

jquery Event.stopPropagation() seems not to work

Live events don’t follow the same event bubbling rules. See the documentation on live event handling. Quote from reference above: Live events do not bubble in the traditional manner and cannot be stopped using stopPropagation or stopImmediatePropagation. For example, take the case of two click events – one bound to “li” and another “li a”. … Read more

Load content with ajax in bootstrap modal

The top voted answer is deprecated in Bootstrap 3.3 and will be removed in v4. Try this instead: JavaScript: // Fill modal with content from link href $(“#myModal”).on(“show.bs.modal”, function(e) { var link = $(e.relatedTarget); $(this).find(“.modal-body”).load(link.attr(“href”)); }); Html (Based on the official example. Note that for Bootstrap 3.* we set data-remote=”false” to disable the deprecated Bootstrap … Read more

Typeahead problems with Bootstrap 3.0 RC1

update 14 feb 2014 As mentioned by laurent-wartel try https://github.com/hyspace/typeahead.js-bootstrap3.less or https://github.com/bassjobsen/typeahead.js-bootstrap-css for additional CSS to use typeahead.js with Bootstrap 3.1.0. Or use use the “old” (TB 2) plugin with the new Bloodhound suggestion engine: https://github.com/bassjobsen/Bootstrap-3-Typeahead/issues/26 Twitter’s typeahead doesn’t seem ready for Twitter’s Bootstrap 3. To use Twitter’s typeahead with Twitter’s Bootstrap you will need … Read more

Remove span tag in string using jquery

If this is definitely just stored as a string you can do the following… var element = $(myString);//convert string to JQuery element element.find(“span”).remove();//remove span elements var newString = element.html();//get back new string if in fact this is already rendered html in your page then just do… $(“span”).remove();//remove span elements (all spans on page as this … Read more

How to make Chrome remember password for an AJAX form?

I have found a dirty workaround for this problem, by inserting an invisible iframe and targeting the form to it: <iframe src=”https://stackoverflow.com/blank.html” id=”loginTarget” name=”loginTarget” style=”display:none”> </iframe> <form id=”loginForm” action=”https://stackoverflow.com/blank.html” method=”post” target=”loginTarget”></form> The corresponding JavaScript: $(‘#loginForm’).submit(function () { $.post(‘/login’, $(this).serialize(), function (data) { if (data.status == ‘SUCCESS’) { window.location = data.redirectUrl; } }) }) The trick … Read more