jQuery - div not available if runat = server?

<div id="divservicestotal" runat="server">hi</div>

jquery does not seem to be able to find this div

I'm using:

<script type="text/javascript">


    $(document).ready(function () {
        $('div[id="divservicestotal"]').css('position', 'relative');
        $('div[id="divservicestotal"]').css('float', 'right');
        $('div[id="divservicestotal"]').css('clear', 'both');
        $('div[id="divservicestotal"]').css('background-color', 'red');        
    });

     

     		
    </script>

Open in new window

LVL 5
Tom KnowltonWeb developerAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
leakim971Connect With a Mentor PluritechnicianCommented:
work fine for me...
right on the page in your browser, choose view source, post it here
0
 
Tom KnowltonWeb developerAuthor Commented:
I think I found the problem.

ASP.NET was changing the name to "ctl8_divservicestotal"

So I had to use *= instead of just =.

Thank you!

Tom
0
 
leakim971PluritechnicianCommented:
0
 
Tom KnowltonWeb developerAuthor Commented:
super!

thx!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.