jquery with mvc

Last post 11-13-2009 2:47 PM by PraveenaReddyName. 3 replies.

Sort Posts:

  • jquery with mvc

    11-13-2009, 11:13 AM
    • Member
      40 point Member
    • erics44
    • Member since 09-27-2006, 1:39 PM
    • Posts 118

    I am really struggling getting started with jquery, i cant get anything to work appart from an alert message


    function handlesClick() {
        $("table#mytable").addClass("label");
    }
        </script>


    why doesnt that work?


    can give me a step by step example of something very very simple that will work, just to change the color of something or something


    thansk in advance


  • Re: jquery with mvc

    11-13-2009, 11:21 AM
    Answer
    • All-Star
      127,676 point All-Star
    • XIII
    • Member since 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 13,931
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    there are plenty of little samples over at docs.jquery.com. Like for example this one: http://docs.jquery.com/Attributes/addClass#class.

    Also I would rather write  

    $("#mytable tr td").addClass("somegreatbackgroundcolorclass");

    than

    $("table#mytable")

    Where mytable is the id of the table you want to target.

    Grz, Kris.

  • Re: jquery with mvc

    11-13-2009, 1:58 PM
    Answer
    • Contributor
      4,382 point Contributor
    • tgmdbm
    • Member since 12-17-2007, 2:08 PM
    • Posts 883
    • ASPInsiders
      TrustedFriends-MVPs
    <div id="clickme">click me!</div>
    
    <div id="mytable">text</div>
    
    <script type="text/javascript">
    
    $(document).ready(function(){
      $("#clickme").click(function(){
        $("#mytable").addClass("class").css("font-size", "15pt")
      });
    });
    
    </script>

    jquery is very nice to use definitely go to jquery.com

  • Re: jquery with mvc

    11-13-2009, 2:47 PM

    <script type="text/javascript" src="../../Scripts/jquery-1.3.2.js"> </script>

    [ Try using this line before the line "<script type="text/javascript">" ]

    Like this: <script type="text/javascript" src="../../Scripts/jquery-1.3.2.js"> </script>

                 <script type="text/javascript">

                  function Ex(){ alert('Example'); }

                 </script>

     

Page 1 of 1 (4 items)