Click here to Skip to main content
16,023,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm bulding a UI designer using HTML, javascript where I need to highlight active node after clicking. But how that happens.

//highlight active node
$(this).css("border", "1px dotted red");
activatedNode=this;
activatedNodeStyle=$(this).css("border");
//restore/disable highlight
if(activatedNode!=null && activatedNodeStyle!=null)
$(activatedNode).css("border", activatedNodeStyle);

What I have tried:

Is it possible only using css or not?
Posted
Updated 10-Aug-16 20:01pm
Comments
Karthik_Mahalingam 11-Aug-16 1:33am    
what is the issue ?

1 solution

It is not possible using on css you need some jquery or javascript help. Here is the sample code using HTML & Jquery.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function () {
$(".row").click(function () {
$(".row").removeClass("highlight");
$(this).addClass("highlight");
});
});

</script>
<style type="text/css">
.row {
float:left;
padding:10px 100px;
border:solid 1px #ccc;
margin: 0 10px;
}
.highlight {
border:solid 1px red;
}
</style>
</head>

<body>
<div class="row"></div>
<div class="row"></div>
<div class="row"></div>
</body>
</html>
 
Share this answer
 
v2
Comments
Member 11987268 11-Aug-16 10:16am    
So many thnx sir. Its Working great...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900