Solved

jQuery - div not available if runat = server?

Posted on 2013-01-15
4
450 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Jquery-Javascript setAttribute function help 7 18
Add a Condition in ASP Repeater 6 34
jquery + C#.net radiobuttonlist 3 30
Please explain purpose of GZIP 4 34
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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)

861 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