How do we change the border style using java script of a div element written in HTML | Sololearn: Learn to code for FREE!

+1

How do we change the border style using java script of a div element written in HTML

4/27/2021 8:44:50 AM

mustafa raza

7 Answers

New Answer

+5

//Select your element using any selector function (querySelector, getElementById, etc): let element = document.querySelector(".elem") //And then change border style: element.style.border = "1px solid #F00"; https://code.sololearn.com/WKZSK0LUsr7O/?ref=app

+2

document.querySelector("div").borderStyle="groove";

+2

mustafa raza Please don't mark your own answer as the best because in this case it doesn't answer the question.

+1

Thank you all of you But what if i want to change border style when click on div element area.

0

Artem I did't know that tick is used for best answer i clicked it because i want my question on top so that i can get answer quickly.