gpt-3.5-turbo-0613· openai
Suzhen/CodeChat
write me a code based on this line passiveTab('appServicesLi', 'appServices');
- User
write me a code based on this line passiveTab('appServicesLi', 'appServices');
- Assistant
Certainly! Here's an example of a code snippet based on the line you provided:
javascriptfunction passiveTab(tabId, contentId) { // Get the tab element and the content element const tab = document.getElementById(tabId); const content = document.getElementById(contentId); // Add a class to the tab to indicate it is the active tab tab.classList.add('active'); // Add a class to the content to indicate it is visible content.classList.add('visible'); } // Example usage passiveTab('appServicesLi', 'appServices');In this code, the
passiveTabfunction takes two parameters:tabIdandcontentId. It first fetches the tab element and the content element using their respective IDs. Then, it adds a class of "active" to the tab element and a class of "visible" to the content element.Finally, the code demonstrates an example usage of the
passiveTabfunction by calling it with the provided IDs ('appServicesLi' and 'appServices').