I would like to know how to apply an edge to the element by means of javascript

Asked

Viewed 35 times

-3

    
    function domingo(){
        var domingo= document.getElementById("domingoid");
        alert(domingo)
        
    }
        <div class="btn" id="domingoid" onclick="domingo();">
            <h2 class="paddi"> DOMINGO </h2>
            <h3>20 de Outubro</h3>
        </div>

  • 1

    Which element? At what time?

  • Without knowing under what circumstances the edge should be applied, giving an answer is something complex. Because depending on when the edge should be applied, the answer may not be what you expect. Ex: if the goal is to apply the edge reacting to the mouse passage, then the best and simplest option is not Javascript, the best option in this scenario is CSS using the pseudo-class :hover.

1 answer

0

You can use javascript’s classList option to add or remove classes, or use the style property.

let domingo = document.querySelector("#domingoid");

domingo.style.border = '1px solid blue';
domingo.style.borderRadius = '25px';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.