Skip to content
Advertisement

how to set backgroundImage with javascript

JavaScript

Hello, I am trying to set two colors for linear-gradient as parameters inside a specific element’s background-image property, but it seems that something is wrong with my setProperty. Everything is working fine except this line of code. I’ve also tried it with style.backgroundImage with no result. I am new to js. Thanks in advance

Advertisement

Answer

Use below code . It worked

JavaScript
Advertisement