I want the bootstrap class of the link to be changed when a link is clicked .
<a href="link1"> link to be clicked </a>
<a href="link2" id="x" name = "x" class="btn btn-info btn-sm disabled">link to be changed</a>
I want the bootstrap class of the link to be changed when a link is clicked .
<a href="link1"> link to be clicked </a>
<a href="link2" id="x" name = "x" class="btn btn-info btn-sm disabled">link to be changed</a>
Presuming you don't want the link to be clicked, you could always just hide it using javascript.
<a href="#" onClick='document.getElementById("2").style.display = "none"'>link to be clicked </a>
<a href="#" id="2" name = "2">link to be disabled</a>
EDIT: Just noticed you updated your question, you can try this it adds the disabled class to the link.
<a href="#" onClick='document.getElementById("2").classList.add("disabled")'>link to be clicked </a>
<a href="#" id="2" name = "2">link to be disabled</a>
You can read more about the disabled class on the bootstrap documentation here: https://getbootstrap.com/docs/4.0/components/buttons/#disabled-state
You can change your code as below, it will help you to achieve your requirement easily.
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.0/css/bootstrap.min.css"/>
</head>
<body>
<a href='#' OnClick = "document.getElementById('2').removeAttribute('Class');document.getElementById('2').setAttribute('Class','btn btn-info btn-sm disabled');" > link
to be clicked </a>
<a href="link2" Class='btn btn-info btn-sm' id="2" name = "2"> link to be disabled </a>
</body>
</html>