?
Solved

Why my jquery code not doing a thing and no errors?

Posted on 2011-10-09
6
Medium Priority
?
142 Views
Last Modified: 2012-05-12
Hi, I'm using asp.net and C# and jQuery.  Please see the attached Master and Content page.  I have ref to jquery in Masterpage and then the jQuery script is in the content page head section.  When I click on the listbox there supposed to be label and textbox that appear but nothing happens.  Looking at the Firebug and still nothing happen.  I checked the script in Firebug and put in a couple of breakpoints and those breaks were never triggered.  I then added a link to hide the email label in Content page and that didn't happen either.  Can someone please help with this.  I've been stocked in this problem for days.
MasterPage.master
AddNewPatient.aspx
AddNewPatient.aspx
0
Comment
Question by:lapucca
  • 3
  • 2
6 Comments
 
LVL 19

Expert Comment

by:Greg Alexander
ID: 36940224
Just did a quick look, try moving the inclusion of jquery itself to the top of the page... not an asp programmer but that seems like it would help..
0
 

Author Comment

by:lapucca
ID: 36940259
Top of which page?  I added the ref to jQuery to the content page head section to test and see if that would make it work but it didn't.  In the Master page there is already ref to jQuery library so it is at the top.  I don't think there is a problem to the jQuery ref because I don't get '$' not define error and also, the superfish jQuery plugin menu works with no problem.  Thank you.
0
 
LVL 10

Expert Comment

by:gavsmith
ID: 36941700
It would appear you are trying to set a function to (document).ready twice (source line 14 and 29). My guess would be if it's doing the snapfish script ok, it's ignoring the 2nd attempt to set the function.

hope that helps
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lapucca
ID: 36946956
I removed the script block from the Content page and put a test jQuery code to hide a label after the superfish function in the Master Page's script are, but that didn't work either.  I even used the ClientId foudn in the Page Source view for ref that label.  
<script type="text/javascript" language="javascript">      
            $(document).ready(function() {
            $('ul.sf-menu').superfish();

            $('ctl00_ContentPlaceHolder1_lbEmail').hide();   
            }); 
    </script>

Open in new window

0
 
LVL 10

Accepted Solution

by:
gavsmith earned 2000 total points
ID: 36947573
Sorry, that was just my first guess...

When selecting items using an ID you have to use a # prefix, change code to:

<script type="text/javascript" language="javascript">      
            $(document).ready(function() {
            $('ul.sf-menu').superfish();

            $('#ctl00_ContentPlaceHolder1_lbEmail').hide();   
            }); 
    </script>

Open in new window

0
 

Author Closing Comment

by:lapucca
ID: 36953548
You're a lifesaver.  I've been stocked with this for couple of weeks!  Once I added the # then most of my script is working again.  thank you.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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)
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…
Suggested Courses

621 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