jQuery mobile $(document).ready equivalent

I spent some time on researching the same since JQM docs are not very detailed at this point. Solution below works fine for me: <script type=”text/javascript”> $(‘div:jqmData(role=”page”)’).live(‘pagebeforeshow’,function(){ // code to execute on each page change }); </script> You have to implement your own checking flow in order to prevent multiple initialization since the code above … Read more

Preview Image before uploading Angularjs

OdeToCode posted great service for this stuff. So with this simple directive you can easily preview and even see the progress bar: .directive(“ngFileSelect”,function(){ return { link: function($scope,el){ el.bind(“change”, function(e){ $scope.file = (e.srcElement || e.target).files[0]; $scope.getFile(); }); } } It is working in all modern browsers! Example: http://plnkr.co/edit/y5n16v?p=preview

Extract part of HTML document in jQuery

You can use your standard selector syntax, and pass in the data as the context for the selector. The second parameter, data in this case, is our context. $.post(“getstuff.php”, function(data){ var mainDiv = $(“#mainDiv”, data); // finds <div id=’mainDiv’>…</div> }, “html”); This is equivalent to doing: $(data).find(“#mainDiv”); Depending on how you’re planning on using this, … Read more

MVC5, AjaxHelper, and the Correct Scripts & Load Order

The very minimum you need for AjaxHelper NuGet Package Microsoft jQuery Unobtrusive Ajax 3.1.2 > Install-Package Microsoft.jQuery.Unobtrusive.Ajax -Version 3.1.2 Now include the scripts <script src=”https://stackoverflow.com/questions/23895918/~/jquery-1.11.0.js”></script> <script src=”~/jquery.unobtrusive-ajax.js”></script> Go ahead and get the latest version if available. I specified v3.1.2 to demonstrate that the AjaxHelper worked for at least this particular version at a particular time.

How to decrease request payload of p:ajax during e.g. p:dataTable pagination

Indeed, when you submit a form in HTML, by default every single HTML input element will be sent as request parameter. PrimeFaces ajax components therefore offer the partialSubmit=”true” attribute which will then send only the HTML input elements covered by the process attribute, which defaults in <p:ajax> to @this and in <p:commandXxx> to @form. So, … Read more