I am trying to change the style of a button (which is really just a div). I can do it in CSS with .classname:active, but the button only changes style while it is being clicked; it doesn't maintain the style changes after the click is released. So, I decided to use jQuery to manipulate the CSS. It is worth noting that I am also using Bootstrap and Angular in my application.
HTML
<div class="subcontainer">
<div class="center" data-container="body" popover-template="'popover-template.html'">
{{instance}}
</div>
</div>
jQuery
$(document).ready(function() {
$(".subcontainer").click(function() {
$(this).css("border", "1px inset gray");
});
});
I have also tried using $(".subcontainer").on("click", function () { ... });, but to no avail. I looked at jQuery UI but I don't think it has a quick-fix solution to what I'm trying to achieve, so I'd like to stick with plain jQuery.
EDIT:
The code above works on all elements that aren't nested inside an ng-repeat. I'm trying to solve why it isn't working for those elements inside of an ng-repeat.
See https://stackoverflow.com/questions/31972784/injecting-jquery-into-angularjs-directive if you are trying to use inject jQuery into an AngularJS directive.
toggleClasslike i was saying above. example: jsfiddle.net/Ls8q00wn