0

I am working on one of the asp.net project which uses Drop-down Menus from from Dynamic Drive

After using it with asp.net Menu control asp.net automatically adds styles to it. I want to replace part of CSS Style using jQuery from the following code. I would appreciate help in this regards.

<li class="" aria-haspopup="Menu1:submenu:11" role="menuitem" style="position: relative; float: left; z-index: 100;">
<a href="#?PageId=49&amp;Language=en-US" class="popout level1 static" tabindex="-1" style="padding-right: 10px;">MAIN MENU<img style="border:0;" class="downarrowclass1" src="../down.gif"></a>
    <ul class="" id="Menu1:submenu:11" style="display: none; position: absolute; top: 28px; left: 0px; visibility: visible; width: 186px;">
        <li role="menuitem" class="" style="position: relative;">
            <a href="#?PageId=50&amp;Language=en-US&amp;" class="level2 dynamic" tabindex="-1">SUB MENU</a>
        </li>
        <li role="menuitem" class="" style="position: relative;">
            <a href="#?PageId=52&amp;Language=en-US&amp;" class="level2 dynamic" tabindex="-1">SUB MENU/a>
        </li>
        <li role="menuitem" class="" style="position: relative;">
            <a href="#?PageId=51&amp;Language=en-US&amp;" class="level2 dynamic" tabindex="-1">SUB MENU</a>
        </li>
    </ul>
</li>

I want to change the style value of top: 28px; in UL with id="Menu1:submenu:11" to top:-58px; I am not sure how I can do.

HTML code is exact copy of asp.net web form in the browse.

I am not sure how I can reference to element with id Menu1:submenu:11 using jQuery & over right the whole style property style="display: none; position: absolute; top: 28px; left: 0px; visibility: visible; width: 186px;"

Learning
  • 19,469
  • 39
  • 180
  • 373

2 Answers2

0

All style changes are easy once you know how:

 $('#Menu1:submenu:11').css('top':-58);

See here for a lot more details

edit

I just saw that your problem is that you can't access the selector: $('#Menu1:submenu:11')? I suggest submitting another question or searching a little more to find this answer.

Community
  • 1
  • 1
Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291
0
$('#Menu1:submenu:11').style.top = "-58px";
czioutas
  • 1,032
  • 2
  • 11
  • 37