Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

How do I assign a style with a select option and send style to JSON and then display in html table?

Dear Mr/Mrs/Ms. Mortal,
I have a hard time trying to understand what you're asking, not just here but in every question I read. After investing time I ask myself "Why do they want to do that?". My hang-up is your use of Json, but I think I got it with this question.
You're not styling every little element with a selection process, but picking an overall style sheet to use for the page or table. Is that correct?
When I have done this in the past the selection was stored locally and JS used to retrieve it on page load.
 
When you select "Present" from the select input,
Dear Mr/Mrs/Ms. Mortal,
I have a hard time trying to understand what you're asking, not just here but in every question I read. After investing time I ask myself "Why do they want to do that?". My hang-up is your use of Json, but I think I got it with this question.
You're not styling every little element with a selection process, but picking an overall style sheet to use for the page or table. Is that correct?
When I have done this in the past the selection was stored locally and JS used to retrieve it on page load.
the word "Present" in the html table (data comes from JSON file), will have the green theme. And if Tardy is selected, then the tardy theme will be applied anytime the word absent shows up on the html table and if absent is selected then the Absent theme will be applied anytime the word absent shows up on the html table. I don't know if I'm explaining it properly but I hope I am.
 
OK, this will be done server-side with PHP. PHP will read the data from the DB and construct a JSON file. It will check for the presence of one of the three words and use that to determine the style and send that info in the same file. JS will read that and change the style of as many elements as needed.

Do you require an example?
 
OK, this will be done server-side with PHP. PHP will read the data from the DB and construct a JSON file. It will check for the presence of one of the three words and use that to determine the style and send that info in the same file. JS will read that and change the style of as many elements as needed.

Do you require an example?
yes.
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom