Click here to Skip to main content
15,917,997 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to get 'backgroundPosition' of control, which works fine on chrome but as usual not on IE.
Workaround for this i am using background-position-x,background-position-y,backgroundPositionX,backgroundPositionY properties of jquery.The properties mentioned above works fine for one of my application on IE but doesn't give any result on other application.
Can't really get how's it possible that certain predefined properties are supported by particular app and not by other.
Posted
Comments
Sandeep Mewara 28-Oct-12 5:24am    
Share the css code you wrote.
Dexter11 29-Oct-12 6:39am    
This is my URL for the page http://www.hipbench.com/
Check this $(document.getElementById('ctl00_ebtnSearch')).css('backgroundPosition')
On chrome it returns me "100% 0px" whereas on IE it returns "0% 0%"

1 solution

I'd look into a different way of retrieving the property, personally.
If you look at the DOM in both Chrome and IE9, it's the same - it seems that the problem (surprise, surprise) is with jQuery. It's returning dodgy information...


IE:
HTML
<input style="width: 100%; padding-right: 0px; padding-left: 4px; font-weight: bold;" id="ctl00_ebtnSearch_input"></input>


Chrome:
HTML
<input class="rbDecorated" type="submit" name="ctl00$ebtnSearch" id="ctl00_ebtnSearch_input" value=" Search " style="font-weight:bold;width:100%;padding-left:0;padding-right:0;padding-left:4px;"></input>


In fact, this returns "" in both browsers:
HTML
document.getElementById('ctl00_ebtnSearch_input').style.background


Which is entirely reasonable, given that clearly from the DOM, there is no inline style (or one applied through javascript) that affects .style.background - or any of background's attributes.


What are you trying to get, and for what purpose? Perhaps there's another solution that's not been considered..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900