简体   繁体   中英

Jquery wont select and add the style i want to my element

I have a control called message popover and this has a list of items. when the user clicks on an item in the list they get a description. inside this description is an icon. i want to move this icon down from the top by 5px.

when i run the application and then type

jQuery("#__icon0").css('marginTop', '5px'); 

in the console the icon moves to where i want it to. but when i place it in the code (init or some where else on the page, it does nothing and the icon doesnt move.)

does anyone know why?

Can you try .css('margin-top', '5px'); instead of .css('marginTop', '5px'); ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM