My codes in HTML:
<p><input type="text" class="txt" id="u" /><label for="u">user</label></p>
<p><input type="text" class="txt" id="p" /><label for="p">pass</label></p>
Javascript:
$(document).ready(function() {
if( $('.txt').val() ) {
//change st in related label tag
}
});
How to do that? Please help me solve this issue. Thank you very much !
You can do:
with:
While an input field has focus, its label (assuming it has one) is highlighted.
Edit: To traverse the inputs and do something with the labels:
or simply:
or you can go the other way: