Solved

jQuery - div not available if runat = server?

Posted on 2013-01-15
4
443 Views
Last Modified: 2013-01-15
<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

0
Comment
Question by:knowlton
  • 2
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38779731
work fine for me...
right on the page in your browser, choose view source, post it here
0
 
LVL 5

Author Comment

by:knowlton
ID: 38779744
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
 
LVL 82

Expert Comment

by:leakim971
ID: 38779757
0
 
LVL 5

Author Comment

by:knowlton
ID: 38779920
super!

thx!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now