For example if I have lots of this:
<div class="form-group">
<div class="col-xs-2"><label for="USER_FORM___unique_id" class="control-label">Employee ID</label> </div>
<div class="col-xs-5"><input disabled="disabled" type="text" class="form-control" id="USER_FORM___unique_id__orig" value="20141100497"> </div>
<div class="col-xs-5"><input type="text" class="form-control" id="USER_FORM___unique_id" value="20141100497"> </div>
</div>
<div class="form-group">
<div class="col-xs-2"><label for="USER_FORM___name" class="control-label">Name</label> </div>
<div class="col-xs-5"><input disabled="disabled" type="text" class="form-control" id="USER_FORM___name__orig" value="20141100497"> </div>
<div class="col-xs-5"><input type="text" class="form-control" id="USER_FORM___name" value="Me me me me"> </div>
</div>
<!-- and so on -->
I want to add border on the parent
div.form-group, only when the last innerinput.col-xs-5focused/hoveredor highlighting the
label.control-labelonly when the for attribute it refer to focused/hoevered
Is it possible to use CSS only to do this?
I know that this is possible using jQuery, by adding onfocus="highlight(this)", onblur="highlight(this)", onmouseenter="highlight(this)", and onmouseleave="highlight(this)" on the last input:
function highlight(el) {
el = $(el);
var focused = el.is(":focus");
var style1 = focused ? '1px solid blue' : '';
$(el).parent().css('border',style1); // 1
var style2 = focused ? 'underline' : '';
$(el).prev().prev().css('text-decoration',style2); // 2
}