Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

edit existing inline style using jquery?

I have some html which seems to default to :

<ul style="top: 72px; visibility: hidden;">

But i need Jquery to rescue me and change top: 72px to top: 37px

Is this possible? as in Firefox 37px seems to show up but in IE7 it shows up as 72px

Thanks

edit: added more info

the ul id = treemenu1

and its parent element is div class = treemenu

like image 851
PD24 Avatar asked Dec 02 '11 16:12

PD24


2 Answers

$('#treemenu1').css({ top: 37 });

Should work fine.

jsFiddle of POC.

like image 131
Chad Avatar answered Sep 23 '22 20:09

Chad


I would select your ul by id:

$("#treemenu1").css("top", "37px");

Also note that you can update multiple css properties at once by passing an object in, whose keys and values correspond to css properties, and their new values:

$("#treemenu1").css({ "top": "37px", "bottom": "20px" });
like image 32
Adam Rackis Avatar answered Sep 24 '22 20:09

Adam Rackis