You may want to wait until all assets have loaded (such as images and certain JSON requests) prior to performing an action in JQuery. To do this, wrap your code in the following listener: $(window).load(function(){ }); This is different than what is typically done: $(document).ready(function(){ }); This allows us to wait until the DOM has […]
Month: November 2013
Check if checkbox is checked with Jquery
To check if an HTML checkbox is checked with JQuery, do the following: if($(“#the-element).is(“:checked”)){ }
Get root domain with Rails
To retrieve the root domain within the Rails framework, use the following method: request.domain Given the following GET request: http://www.example.com/users/1/edit The above method will retrieve: example.com Caveat: This will not work within your models.