Foundation CSS JavaScript Miscellaneous Utilities Last Updated : 02 Feb, 2023 Comments Improve Suggest changes Like Article Like Report Foundation CSS is a responsive front-end framework for building web applications. It includes a set of CSS styles and JavaScript functions that can be used to create a responsive layout and add interactivity to a website. Foundation CSS JavaScript miscellaneous utilities: Foundation.GetYoDigits([number, namespace]): This function with optional parameters returns a base-36, 6 character long random string with a hyphenated namespace. Foundation.getFnName(fn): This function returns a string representation of a named function.Foundation.transitionend(): This function returns the string of the vendor-prefixed version of transitionend events. Example 1: This code demonstrates how to use the Foundation.GetYoDigits() function. The Foundation.GetYoDigits() function takes two arguments: the length of the ID you want to generate, and a prefix to use for the ID. In this example, the function generates a 6-character ID with the prefix "my-element"We create a button and a div element to display the generated ID and then add an event listener to the button that calls the Foundation.GetYoDigits() function and updates the text content of the div element with the generated ID when the button is clicked. HTML <!DOCTYPE html> <html> <head> <title>Foundation GetYoDigits Example</title> <link rel="stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/css/foundation.min.css" /> <script src= "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"> </script> <script src= "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/js/foundation.min.js"> </script> </head> <body> <center> <h1 style=color:green>GeeksforGeeks</h1> <h3> Foundation CSS JavaScript Miscellaneous Utilities</h3> <button id="generate-id-button"> Generate ID </button> <div id="generated-id"></div> <script> // Get a reference to the button and generated ID element var button = document.getElementById('generate-id-button'); var generatedID = document.getElementById('generated-id'); button.addEventListener('click', function() { // Generate a new ID with the Foundation.GetYoDigits var newID = Foundation.GetYoDigits(6, 'my-element-'); generatedID.textContent = newID; }); </script> </center> </body> </html> Output: Example 2: This code demonstrates how to use the Foundation.getFnName() function. In this example, we define a test function and create a button and a div element to display the function name.We then add an event listener to the button that calls the Foundation.getFnName() function and passes in the test function as an argument. The function returns the name of the function, which is then displayed in the div element when the button is clicked. HTML <!DOCTYPE html> <html> <head> <title>Foundation getFnName Example</title> <link rel="stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/css/foundation.min.css" /> <script src= "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"> </script> <script src= "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/js/foundation.min.js"> </script> </head> <body> <center> <h1 style=color:green>GeeksforGeeks</h1> <h3> Foundation CSS JavaScript Miscellaneous Utilities</h3> <button id="get-fn-name-button">Get Function Name</button> <div id="function-name"></div> <script> function testFunction() { console.log('This is a test function'); } var button = document.getElementById('get-fn-name-button'); var functionName = document.getElementById('function-name'); button.addEventListener('click', function() { // Get the function name with the Foundation.getFnName var fnName = Foundation.getFnName(testFunction); functionName.textContent = fnName; }); </script> </center> </body> </html> Output: Example 3: In this example, we create a button and a div element and add a transition to the div element. When the button is clicked, the width of the div element is toggled between 100px and 200px, causing the transition to occur. We use the Foundation.transitionend() function to listen for the end of the transition, and log a message to the console when the transition is complete. HTML <!DOCTYPE html> <html> <head> <title>Foundation transitionend Example</title> <link rel="stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/css/foundation.min.css" /> <script src= "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"> </script> <script src= "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.6.3/js/foundation.min.js"> </script> </head> <body> <center> <h1 style=color:green>GeeksforGeeks</h1> <h3> Foundation CSS JavaScript Miscellaneous Utilities</h3> <!-- Create a button to trigger the transition --> <button id="transition-button"> Trigger Transition </button> <!-- Create a div to apply the transition to --> <div id="transition-div" style="background-color: red; width: 100px; height: 100px; transition: width 0.5s ease;"> </div> <script> var button = document.getElementById('transition-button'); var transitionDiv = document.getElementById('transition-div'); button.addEventListener('click', function() { // Toggle the width of the // transition div between 100px and 200px if (transitionDiv.style.width === '100px') { transitionDiv.style.width = '200px'; } else { transitionDiv.style.width = '100px'; } }); // Use the Foundation.transitionend function // to listen for the end of the transition Foundation.transitionend(transitionDiv, function() { console.log('Transition ended'); }); </script> </center> </body> </html> Output: Reference: https://get.foundation/sites/docs/javascript-utilities.html#miscellaneous Comment More infoAdvertise with us Next Article Foundation CSS JavaScript Miscellaneous Utilities bakkeshks Follow Improve Article Tags : Technical Scripter Web Technologies CSS Technical Scripter 2022 Foundation Foundation-Setup +2 More Similar Reads Foundation CSS JavaScript Utilities Foundation JavaScript Utilities is a collection of tools that can be used to enhance the functionality of your Foundation website. To use Foundation JavaScript Utilities, you first need to include the foundation.js file in your website. Once you have done this, you can use the various utilities by c 4 min read Foundation CSS JavaScript using Plugins Foundation CSS is an open-source & responsive front-end framework built by ZURB foundation in September 2011, that makes it easy to design beautiful responsive websites, apps, and emails to look amazing & can be accessible to any device. It is used by many companies such as Facebook, eBay, M 3 min read Foundation CSS JavaScript A Foundation CSS is an open-source and responsive front-end framework created by ZURB in September 2011 that makes it simple to create stunning responsive websites, apps, and emails that operate on any device. Many companies, like Facebook, eBay, Mozilla, Adobe, and even Disney, use it. The framewor 4 min read Foundation CSS Prototyping Utilities Foundation CSS is an open-source and responsive front-end framework built by the ZURB foundation in September 2011, that makes it easy to layout stunning responsive websites, apps, and emails that appear amazing and can be accessible to any device. The Prototyping Utilities facilitate the building o 3 min read Why learn JavaScript Foundations ? JavaScript is like a cornerstone in the world of programming languages. It's famous for being adaptable and everywhere. No matter if you're into making websites, or mobile apps, or diving into server stuff, understanding the basics of JavaScript is super important. Let's talk about why it's so cruci 4 min read Foundation CSS JavaScript Events Foundation CSS JavaScript is a set of JavaScript tools and plugins that can be used to add interactivity and functionality to your website. It includes a variety of plugins for things like modals, alerts, and accordions, as well as utility functions for handling events and working with the DOM. Foun 3 min read JavaScript Functions Coding Practice Problems Functions are the backbone of JavaScript, allowing developers to write modular, reusable, and efficient code. This curated list of problems will help you master JavaScript Functions. Whether you're a beginner or looking to refine your expertise, these problems will enhance your JavaScript skills!Fun 1 min read JavaScript Fundamentals Coding Practice Problems Mastering the fundamentals of JavaScript is important for building a strong foundation in web development. This comprehensive guide covers a curated list of JavaScript fundamentals coding practice problems across various fundamental topics, including operators, control flow, numbers, strings and mor 2 min read JavaScript Function Complete Reference A JavaScript function is a set of statements that takes inputs, performs specific computations, and produces outputs. Essentially, a function performs tasks or computations and then returns the result to the user.Syntax:function functionName(Parameter1, Parameter2, ..) { // Function body}Example: Be 3 min read JavaScript | Top 10 Tips and Tricks For web development or cross-platform development, JavaScript is gaining wide popularity. Once it was considered only as a front-end scripting language but it's now getting popularity as the back-end too. Even Facebook's React Native is based on JavaScript. Hence it would surely be beneficial to kno 6 min read Like