Updating layouts jquery code with fix