Why don’t changes to jQuery $.fn.data() update the corresponding html 5 data-* attributes?

Normally, there’s not a need for roundtripping .data()‘s if you’re consistent in using .data() to access/set/modify data on DOM elements. For that reason, it makes sense to avoid the performance overhead of accessing the DOM for every .data() set/modify operation (.data() stores its values in jQuery.cache internally). If you want to force the roundtrip behavior … Read more

jQuery UI Tabs back button history

I just ran into this as well. Its really easy with the jquery address plugin here http://www.asual.com/jquery/address/ The demo for tabs seemed a bit over complicated. I just did this: $(‘document’).ready(function() { // For forward and back $.address.change(function(event){ $(“#tabs”).tabs( “select” , window.location.hash ) }) // when the tab is selected update the url with the … Read more

jQuery JSON response always triggers a ParseError

Maybe I’m misunderstanding, but couldn’t you set the dataType to text and JSON.parse() the returned data? success: function(data) { data = JSON.parse(data); // process data }, Edited to add generally agreed upon solution (previously a comment only): I just took a look at api.jquery.com/jQuery.ajax and it looks like with jQuery 1.5 you can do a … Read more

How do you animate the value for a jQuery UI progressbar?

DEMO 1: the first one, proof of concept $(function() { var pGress = setInterval(function() { var pVal = $(‘#progressbar’).progressbar(‘option’, ‘value’); var pCnt = !isNaN(pVal) ? (pVal + 1) : 1; if (pCnt > 100) { clearInterval(pGress); } else { $(‘#progressbar’).progressbar({value: pCnt}); } },10); }); DEMO 2:: adaptation of @Peter’s response below for the good sake … Read more

AJAX Post of JavaScript String Array to JsonResult as List Always Returns Null?

I faced the same problem after updating to jquery 1.4.2. You can find the solution here (in the Ajax section). Adding traditional : true in the ajax options should work. $.ajax({ type: “POST”, traditional: true, url: “/Test/JSONTestAction”, async: false, data: parms, dataType: “json”, success: function(data) { // success } });

$http request doesn’t send cookies cross-domain in angular CORS

Have you seen this? Communication between AngularJS and a Jersey Webservice which are on a different domain. Can’t access correct session Try passing a config object to $http that specifies withCredentials, that should work in all versions. $http({withCredentials: true, …}).get(…) And the discussion here: https://github.com/angular/angular.js/pull/1209

CSS for the “down arrow” on a element?

There’s a cool CSS-only solution to styling dropdowns here: http://bavotasan.com/2011/style-select-box-using-only-css/ Basically, wrap the select in a container div, style the select to be 18px wider than the container with a transparent background, give overflow:hidden to the container (to chop off the browser-generated arrow), and add your background image with stylized arrow to the container. Doesn’t … Read more

tech