bikerchris Posted October 24, 2018 Share Posted October 24, 2018 (edited) Hi all, As I said, sorry to bother you but hope someone can help, I've got two bits of code and they're not playing nicely together. The first is part of a mobile friendly burger dropdown: <script> // Used to toggle the menu on small screens when clicking on the menu button function myFunction(Nav) { var x = document.getElementById("Nav"); if (x.className.indexOf(" w3-show") == -1) { x.className += " w3-show"; } else { x.className = x.className.replace(" w3-show", ""); } } </script> The second is linked to a w3 search facility(table): <script> function myFunction() { var input, filter, table, tr, td, i; input = document.getElementById("myInput"); filter = input.value.toUpperCase(); table = document.getElementById("myTable"); tr = table.getElementsByTagName("tr"); for (i = 0; i < tr.length; i++) { td = tr[i].getElementsByTagName("td")[0]; if (td) { if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { tr[i].style.display = ""; } else { tr[i].style.display = "none"; } } } } </script> The second interferes with the first and I wonder how I can tweak it and the associated html so it plays nicely. I've tried changing a few bits, like an amateur would, but with no joy. Thanks in advance. Chris Edited October 24, 2018 by bikerchris spelling error Link to comment Share on other sites More sharing options...
Ingolme Posted October 24, 2018 Share Posted October 24, 2018 Give the functions different names. 1 Link to comment Share on other sites More sharing options...
bikerchris Posted October 25, 2018 Author Share Posted October 25, 2018 21 hours ago, Ingolme said: Give the functions different names. Thank you @Ingolme, I'll give it a go. Link to comment Share on other sites More sharing options...
bikerchris Posted October 25, 2018 Author Share Posted October 25, 2018 Good grief, thank you again @Ingolme, I was changing completely the wrong thing. It now works 😀 I appreciate you probably deal with silly questions like this often, so thank you again. I'll try to keep them to a minimum and even help out answering the most obvious questions. All the best, Chris Link to comment Share on other sites More sharing options...
Funce Posted October 25, 2018 Share Posted October 25, 2018 I'm pretty sure anyone here would never stop you from asking questions, no matter how trivial the answer may seem. We all start somewhere after all. I'm glad that you've taken the time to ask about it, and implement the solution, and say thanks. I hope you have a great time here. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now