I want to be able to open div to show content and close again. I would also like to revolve the class attribute value to reflect a open, then shut div container. From icon-envelope-close to icon-envelope-open.
This should be a trivial task for someone with your experience. For some strange reason you did not share the updateParameter2() function. Why??? It makes no sense. The community cannot help you with your code if you do not share the code on the forum.
Also id’s are supposed to be unique, but you are using fixed id’s in a loop, especially on the div you want to display. Maybe you should use a class name, or better yet a data-val, that you can use in a css selector.
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
Curious to know what the ==='none' signifies in this context?
This part of the code is used to determine how the current element is displayed. For example, the value of ‘none’ means that the element is not displayed, and ‘block’ means that it is displayed as a block-level element.
You can use F12 to open/close the developer tools, and view the running status of the code in the Console column, and you could use
console.log() to print values or elements to see if the code is executed as you expect. You could also view the detailed code of the script in the Sources column, and add breakpoints to execute the code for debugging.
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
Member
295 Points
910 Posts
Open and shut div inside Repeater using javascript code.
Mar 07, 2021 03:44 PM|peterthegreat|LINK
I want to be able to open div to show content and close again. I would also like to revolve the class attribute value to reflect a open, then shut div container. From icon-envelope-close to icon-envelope-open.
All-Star
53711 Points
24035 Posts
Re: Open and shut div inside Repeater using javascript code.
Mar 07, 2021 04:01 PM|mgebhard|LINK
This should be a trivial task for someone with your experience. For some strange reason you did not share the updateParameter2() function. Why??? It makes no sense. The community cannot help you with your code if you do not share the code on the forum.
All-Star
58464 Points
15788 Posts
Re: Open and shut div inside Repeater using javascript code.
Mar 07, 2021 04:34 PM|bruce (sqlwork.com)|LINK
Also id’s are supposed to be unique, but you are using fixed id’s in a loop, especially on the div you want to display. Maybe you should use a class name, or better yet a data-val, that you can use in a css selector.
Member
295 Points
910 Posts
Re: Open and shut div inside Repeater using javascript code.
Mar 07, 2021 09:17 PM|peterthegreat|LINK
All-Star
58464 Points
15788 Posts
Re: Open and shut div inside Repeater using javascript code.
Mar 08, 2021 03:38 PM|bruce (sqlwork.com)|LINK
In you markup the next element sibling is a span. So you need to navigate two siblings.
this should be trivial debugging in the browser.
Contributor
2400 Points
749 Posts
Re: Open and shut div inside Repeater using javascript code.
Mar 18, 2021 08:14 AM|XuDong Peng|LINK
Hi peterthegreat,
According to the code you provided, I did not find the icon style you used, I just used similar icons for testing.
If you need to change the icon style, you only need to modify the classList of the element accordingly.
Something like this:
Result:
Best regards,
Xudong Peng
Member
295 Points
910 Posts
Re: Open and shut div inside Repeater using javascript code.
Mar 21, 2021 09:25 PM|peterthegreat|LINK
Curious to know what the ==='none' signifies in this context?
Thanks
Member
295 Points
910 Posts
Re: Open and shut div inside Repeater using javascript code.
Mar 21, 2021 09:28 PM|peterthegreat|LINK
how do you debug javascript code?
Contributor
2400 Points
749 Posts
Re: Open and shut div inside Repeater using javascript code.
Mar 22, 2021 01:51 AM|XuDong Peng|LINK
Hi peterthegreat,
This part of the code is used to determine how the current element is displayed. For example, the value of ‘none’ means that the element is not displayed, and ‘block’ means that it is displayed as a block-level element.
For more details, you could refer to related documents: https://www.w3schools.com/cssref/pr_class_display.asp
You can use F12 to open/close the developer tools, and view the running status of the code in the Console column, and you could use console.log() to print values or elements to see if the code is executed as you expect. You could also view the detailed code of the script in the Sources column, and add breakpoints to execute the code for debugging.
Here is a good article: Browser Developer Tools Tutorial: 10+ Tricks You Must Know.
Best regards,
Xudong Peng