How to add a condition to select classes in dom option?
How to add a condition to select classes in dom option?
Akshay29
Posts: 6Questions: 1Answers: 0
<'blotter-table't><istrue?class-a:class:b>
can i use something like this?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I don't really understand what you want to do I'm afraid. Could you restate that?
Thanks,
Allan
If i want to use a class based on a condition i.e use class1 if a variable is true else set class2. Is it possible?
Oh I see - yes, but not in the string. You'd need to do something like:
Allan
<' condition ? 'class-a' : 'class-b' 't>
this is how i tried.. but its not working..
That doesn't look like valid Javascript to me - I presume you are getting a syntax error in your browser's console? Try it like I suggested above.
I need to add it in a way I have mentioned.. in html page within tags. Could you please suggest a way?
Allan
Thank you Allan.
Can we use a variable as a class name??
Sure.
Thank you.