Last active
June 22, 2023 19:41
-
-
Save ryanKinoti/9a54be6a64f941fbc5ad46e8bef728cb to your computer and use it in GitHub Desktop.
Tab switching action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// tab switching | |
function switchcommon(evt, mainName) { | |
var i, tabcontent, tablinks; | |
//get all elements under tabcontent and hide them | |
tabcontent = document.getElementsByClassName("tabcontent"); | |
for (i = 0; i < tabcontent.length; i++) { | |
tabcontent[i].style.display = "none"; | |
} | |
tablinks = document.getElementsByClassName("tablinks"); | |
for (i = 0; i < tablinks.length; i++) { | |
tablinks[i].className = tablinks[i].className.replace(" active", ""); | |
} | |
document.getElementById(mainName).style.display = "block"; | |
evt.currentTarget.className += " active"; | |
} | |
document.getElementById("defaultOpen").click(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
consider the list item on navigation.blade.php.
when I click on the tag of the class "tablinks" the switch the onclick method calls the script in the dashboard.blade.php
the dashboard file calls the navigation file through the @include directive.
what i want is to include AJAX method in the script which will also fetch data from a particular route that access a particular method in a controller and update the content using normal blade syntax and not json please😭