Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

jQuery - div not available if runat = server?

Posted on 2013-01-15
4
Medium Priority
?
456 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:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 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:Tom 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:Tom Knowlton
ID: 38779920
super!

thx!
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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)
Suggested Courses

609 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