Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I'm writing a little JS that can change up the visibility of different items using the class attribute. I was able to get it to work finally by examining the textstyle(x) class that was generated when I go to preview my site, but I am finding that when I "publish" it, RocketCake changes the textstyle(x) class to a different number - and if I make any significant changes, that number changes again. Is there a way to get that output to be more consistent? I also would like to find a way to hide a container using JS, but am a bit stumped at the moment... Help? |
||||
|
For hiding / showing items, best is to put them into an own container: They have IDs which never change, and you can even specify your own ID (in the "HTML Code" dialog) if you like. Textstyle classes always change and are merged with other text styles depending how they appear on your website. For hiding something using JavaScript and an ID, use something like this: document.getElementById("yourid").style.display = "none"; |
||||
|
I have a list and a cursory "search" function that would be able to hide individual lines in the list as you were searching - it might be really, really challenging to put each line into a container? And also - they probably qualify more as a class than an ID? |
||||
|
Hm.. in that case I'd programmatically do that somehow.. like putting each line into a span or div with its own id in the beginning and then hide it depending on what logic you are using. But I guess that totally depends on the details. |
||||
|
my solution to this is (I use jQuery by the way) is to put it in a container (div) and then use something like .find() or $("mydivID span"). Another solution I use is to add a class and then $(".myClass") Also look at :first or :last selectors in css Bear with me, I'm not saying these are the best actions but they work for me. |
|