Solved

jQuery - div not available if runat = server?

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

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

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

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
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 …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

707 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