Rails 3.1 and jquery-ui assets

Example of a working setup: $ cat app/assets/javascripts/application.js //= require jquery //= require jquery-ui $ cat app/assets/stylesheets/application.css /* *= require vendor * */ $ cat vendor/assets/stylesheets/vendor.css /* *= require_tree ./jquery_ui * */ vendor/assets/ $ tree stylesheets vendor.css jquery_ui      jquery-ui-1.8.13.custom.css … images    jquery_ui    ui-bg_flat_0_aaaaaa_40x100.png … Finally run this command: vendor/assets/images $ ln … Read more

Always visible jQuery UI DatePicker

It’s simple. Keep your jQuery code, but assign it to a <div> instead of an input box. Date: <div id=”datepicker”></div> <script> $(function() { $(“#datepicker”).datepicker(); }); </script> A functional example lives at the jQuery UI webpage for the datepicker widget, and I’ve also included one below. $(function() { $(“#datepicker”).datepicker(); }); <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js”></script> <link rel=”stylesheet” href=”https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css”> <script … Read more

jQuery UI dialog button focus

Use the blur method. You can try this sample. <html> <head> <title>No Focus on jQuery Dialog</title> <link type=”text/css” rel=”stylesheet” href=”https://stackoverflow.com/questions/1793592/ui.all.css” /> <script type=”text/javascript” src=”jquery-1.3.2.min.js”></script> <script type=”text/javascript” src=”ui.core.js”></script> <script type=”text/javascript” src=”ui.dialog.js”></script> <script type=”text/javascript”> $(document).ready(function() { // Dialog to confirm or cancel // Focuses on confirm by default. $(‘#noFocusDialog’).dialog({ autoOpen: false, buttons: { Confirm: function() { $(this).dialog(‘close’); … Read more

How do I pass an extra parameter to Jquery Autocomplete field?

You need to use a different approach for the source call, like this: $(“#product”).autocomplete({ source: function(request, response) { $.getJSON(“product_auto_complete.php”, { postcode: $(‘#zipcode’).val() }, response); }, minLength: 2, select: function(event, ui){ //action } }); This format lets you pass whatever the value is when it’s run, as opposed to when it’s bound.