Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 9 Months, 1 Week, 6 Days ago Text Area Conditional
#1
Solved: 9 Months, 1 Week, 6 Days ago
Hello,

I'm setting up an xthreads text area to display an "Admin Notice" and I'd like it to only display IF the text area contains some text. I'm not sure how to do this and was curious if someone could help me with it.
[Image: fbesig.png]

Reply
#2
Solved: 9 Months, 1 Week, 6 Days ago
You can hide the textarea using jquery (or even it is possible by simple template edit : not a clean way though) when the textarea is empty.
[Image: logo.svg.svg]
Reply
#3
Solved: 9 Months, 1 Week, 6 Days ago
(02-20-2019, 12:16 PM)effone Wrote: You can hide the textarea using jquery (or even it is possible by simple template edit : not a clean way though) when the textarea is empty.

Ah perfect. I was able to ad a div id and telll jquery to show it if it contained any text

I basically set up an "Admin Only" input field so that an admin can show an alert on a thread if they need to get the attention of the user.

<script>
$("#admin-alerts").each(function(i, val) {
    if ($(this).text().trim() === "") {
        $(this).hide();
    }
});
</script>

   
[Image: fbesig.png]

Reply
#4
Solved: 9 Months, 1 Week, 6 Days ago
Nice. In case of without jquery set classname as hide{no_admin} and set the chass hide as hidden through css. So if {no_admin} has a value the class name changes and the element eventually shows up.
[Image: logo.svg.svg]
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)