Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Web Pages with WebMatrix
This is the forum to discuss the Wrox book Beginning ASP.NET Web Pages with WebMatrix by Mike Brind, Imar Spaanjaars ; ISBN: 978-1-1180-5048-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Web Pages with WebMatrix section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 9th, 2012, 05:28 PM
Authorized User
 
Join Date: Aug 2010
Posts: 50
Thanks: 7
Thanked 0 Times in 0 Posts
Default Chapter 6:Event Handling using jquery

I wanted another pair of eyes to look at my script for effects. I followed the code as written in the book but for some reason none of the effects are working. The only difference i did was used an update jquery script and Double Quotes. Can someone please take a look. Thanks.

Code:
 <script src="@Href("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
        <script type="text/javascript">
            $(function(){
                $("p").hover(function(){
                    $(this).fadeOut(1000).fadeIn(1000);
                });
                $("div:first").click(function(){
                    $("div:contains(watch)").fadeToggle("slow");
                    $(this).text("Click Again");
                });
                $(":input[type=text]").focus(function(){
                    $(this).val('');
                });
                $(":input[type=text]").keypress(function(){
                    $("#hidden").slideDown("fast");
                }); .keyup(function(){
                    ${"#text").text($(this).attr("value")};
                });
            });
        </script>
 
Old January 10th, 2012, 09:42 AM
Wrox Author
 
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 Posts
Default

You have some errors in the last two lines of code. The following:

Code:
}); .keyup(function(){
should read

Code:
}).keyup(function(){
Remove the semi-colon (;) and the space just before .keyup

And this

Code:
${"#text").text($(this).attr("value")};
should start and finish with parenthesis rather than curly braces:

Code:
$("#text").text($(this).attr("value"));
One of the best ways of trapping javascript syntax errors is by installing Firebug - an add-on for the Firefox browser. It has a Console that reports errors, among other things.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Event handling... arnab-jit ASP.NET 3.5 Professionals 0 January 10th, 2011 05:08 AM
Event Handling C# 2.0 AccessAasif@aol.com C# 2005 2 January 25th, 2008 11:37 AM
Event handling in c# bhavna VS.NET 2002/2003 1 March 7th, 2007 12:19 PM
Event handling in c# bhavna General .NET 1 March 7th, 2007 05:32 AM
Help with Event handling nulogix Java GUI 1 October 11th, 2004 03:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.