0

I'm really struggling with the following:

<td class="left {{tableStyle}}" {{background}} >{{value}}</td>

And my JS code:

{'background':'style="background-color:red;"'}

This results into Failed to execute 'setAttribute' on 'Element': 'style="background-color:red;"' is not a valid attribute name.

I tried insert only values (e.g. style={{data}}) etc. but this is not even possible to run.

2
  • You have a typo, change backgriund to background. Commented May 14, 2024 at 15:58
  • @Amirreza Yes, I wrote it on my phone. The actual code has no typos. Commented May 14, 2024 at 16:00

1 Answer 1

0

Here is the corrected code:

HTML: <td class="left {{style}}" style="{{background}}">{{value}}</td>

JS: {style: 'ClassName', background: 'background-color:red;', value: 'Content'}

The anatomy of your code is wrong, it goes this way in reality: for each attribute you use in your HTML you should provide an attribute-value pair this way:

HTML: {{Attribute}}, JS: {Attribute: 'Value'}

In your original code, if overlooking the typos, there are no values for style and value parameters.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.