The call is not restricted to how many items 1 or 10...
What it has to do is toggle the display css for a div to hide/show content. by using multiple names in the onclick I should be able to toggle 2 items at once.
Also to avoid conflict I would like the div id's to have an operating extension as in:
products_toggle == toggle
products_show == force display: ; if it isn;t already
products_hide == force display: none; if it isn;t already
I am going nuts on trying to get this to work. I have had it work half way there but not all features at once. The code above opens and closes the items but doesn't close all others that are open. each div will be a content panel and the reason for the multiple id's is so I can open a page panel and then show the relevant sub content on that page. For example I might call about_open, contact this should force open the about panel and show a contact form. the using about_open, privacy it should open about panel if not already and show the privacy content while closing all other div's.
If needed I can abbreviated each toggled div with a name as in id="about_content", id="contact_content" etc.
Surely this is something that they've been thinking about for at best a few years and at worse 12 months? Could they not have launched 17.1 as 18, 17.2 as 19, 18.0 as 20 etc until they line up? It wouldn't fit the perfect new major os version with iPhone launch but there will probably be some folks in a few months asking what happened to iOS 19-25 (along with a tonne of youtube videos click baiting on it)
Question
eangulus
HI all I am having trouble getting a javascript to work as I want it.
The code is as follows:
the oc function is to search for a string in an array I found.
I want to call the script like this:
The call is not restricted to how many items 1 or 10...
What it has to do is toggle the display css for a div to hide/show content. by using multiple names in the onclick I should be able to toggle 2 items at once.
Also to avoid conflict I would like the div id's to have an operating extension as in:
products_toggle == toggle
products_show == force display: ; if it isn;t already
products_hide == force display: none; if it isn;t already
I am going nuts on trying to get this to work. I have had it work half way there but not all features at once. The code above opens and closes the items but doesn't close all others that are open. each div will be a content panel and the reason for the multiple id's is so I can open a page panel and then show the relevant sub content on that page. For example I might call about_open, contact this should force open the about panel and show a contact form. the using about_open, privacy it should open about panel if not already and show the privacy content while closing all other div's.
If needed I can abbreviated each toggled div with a name as in id="about_content", id="contact_content" etc.
Please help me.
Link to comment
https://www.neowin.net/forum/topic/631537-help-needed-in-javascript/Share on other sites
19 answers to this question
Recommended Posts