Bug Tracker

Modify

Ticket #5533 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

css(name) method does not work at IE, css( name, value ) work both IE and FF

Reported by: ig4 Owned by:
Priority: minor Milestone: 1.4
Component: attributes Version: 1.3.2
Keywords: CSS method Cc:
Blocking: Blocked by:

Description

I met a issue, I need to setup multi <div> class using jQuery Css. $("div.ucLabelHeader").css(cssLabelHeader); at IE only change first div. only using .each() method + css( name, value ) work both FF and IE

code shown as below: <script type="text/javascript"

src=" http://www.google.com/jsapi"></script>

<script type="text/javascript">

You may specify partial version numbers, such as "1" or "1.3", with the same result. Doing so will automatically load the latest version matching that partial revision pattern (i.e. both 1 and 1.3 would load 1.3.2 today). google.load("jquery", "1.3.2");

google.setOnLoadCallback(function() {

Place init code here instead of $(document).ready()

});

</script>

<script type="text/javascript">

$("document").ready(function() {

var cssObj = {

'width': '500px', 'height': '460px'

} var cssLabelHeader = {

'position': 'static', 'margin': '0px', /*'padding': '3px 0pt 3px 0px',*/ 'padding': '3px 0px 3px 0px', 'width': '460px', 'left': ' '

}

if (!$.browser.msie) {

$("div#ealertScroll").css(cssObj);

$("div.ucLabelHeader").each(function(i) {

alert(i); $(this).css(cssLabelHeader); ONLY WORK AT FF $(this).css('position' , 'static'); Both IE and FF

});

}

});

</script> <div id="ealertScroll" > <div class="ucLabelHeader" style="margin: 0px; padding: 3px 0pt 3px 0px; width: 100%; text-indent: 8px;">1</div> <div class="ucLabelHeader" style="margin: 0px; padding: 3px 0pt 3px 0px; width: 100%; text-indent: 8px;">2</div> <div class="ucLabelHeader" style="margin: 0px; padding: 3px 0pt 3px 0px; width: 100%; text-indent: 8px;">3</div> <div class="ucLabelHeader" style="margin: 0px; padding: 3px 0pt 3px 0px; width: 100%; text-indent: 8px;">4</div> </div>

Change History

comment:1 Changed 4 years ago by caii

Actually, this is the IE bug:

<div id="a" style="background:red; position:absolute; height:100px; width:100px;"></div> <script> document.getElementById("a").style.left= " "; document.getElementById("a").style.backgrounnd="gold"; </script>

the div"#a" 's background won't be gold;

Because the "left" attribute value can't be illegal characters such as " "or "10pm", IE will return an "Error" object, and stop running the following script. Just set it to "10px" or"";

comment:2 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid
  • Component changed from unfiled to attributes

The underlying cause was bad input values, not a jQuery bug.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.