Hi I am trying to set focus to a button when it is tabbed to. The problem I am having is that when i add in the background image for the button the focus color is not being shown around the image but if I remove the image the button works great. How can I put a border around the button when it has focus and reset it on blur?
<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('button:button').focus(function(){
$(this).css({'background-color' : 'red'});
});
$('button:button').blur(function(){
$(this).css({'background-color' : 'lightgreen'});
});
});
</script>
</head>
<body>
<button type='button' id='btnSubmit' style="background-image:
urlbuttonBackground.gif);" >button</button>
</body>
</html>
You can have these styles defined in a css class and then apply the class on
focusand remove it onblur. Try this.Remove the inline styling from
buttonCss (define the styles as per your need)
JS