I'm working on a site where I have input buttons (styled using CSS) that are a part of a form. For example, see below for sample code
<input type="submit" name="buttonSave" value="save" id="buttonsavejs" class="button_image button_style"/>
I've just found an issue where if a user clicks on the button, it moves a few pixels below and then expected action takes place intermittently . But intermittent , I mean that sometimes it works (redirects the user to the next page) and sometimes nothing happens.
The developer who worked on this previously hasn't documented his code much, so I'm trying to work from scratch here (so excuse the lack of details). Anyway, after testing the code, it appears that the issue lies with how newer browsers are rendering the css and javascript.
Here's a snippet of the javascript behind the button's functionality:
$("#buttonsavejs").click(function(){
$("#main").unbind("submit").submit();
And the CSS that styles the button
.button_style {
height:28px;
margin-left:10px;
position:relative;
right:10px;
top:-23px;
width:100px;
}
.button_image {
background-image:url(http://some_image);
border-bottom-width:0;
border-color:initial;
border-image:initial;
border-left-width:0;
border-right-width:0;
border-style:initial;
border-top-width:0;
display:block;
font-size:1px;
line-height:1px;
outline-color:initial;
outline-style:none;
outline-width:initial;
overflow-x:hidden;
overflow-y:hidden;
position:relative;
text-indent:-9999px;
}
Also, I noticed a very similar question asked here: Why do mouse clicks not always work for styled input buttons?
Another piece of what I've been able to find out so far. In IE 9's developer tools, if I switch the Document Mode to anything other than IE 8 or 9, the button behaves as it should. So one line of thinking I have is to set the X-UA-Compatible to IE 7 and see if that resolves it as, apparently, that's how the document mode in IE works: IE8 browser mode vs document mode
Question : After testing in FF (earlier versions < 9.0), IE 7, I noticed that the button works as it should. But in FF 9, Chrome 16, IE 8/9, it behaves as described above. Has anyone run into a similar problem and any advice on what I should be watching out for?
No comments:
Post a Comment