dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: missing } after property list

  1. #1
    Join Date
    May 2012
    Posts
    2

    missing } after property list

    Hey everybody,

    I want to use the JQuery UI Slider (http://jqueryui.com/demos/slider/#steps) in a function within my JavaScript file. So I adapted the code as follows:

    function slideyear() {
    $("#slider").slider({
    min: 1990,
    max: 2008,
    value: 1990,
    step:1,
    change: slideyear( event, ui ) { $( "#year" ).val( ui.value );
    };
    });
    $( "#year" ).val( $( "#slider" ).slider( "value" ) );
    //update_date();
    }


    Now, there is an error in FireBug:


    "missing } after property list" at

    change: slideyear( event, ui ) { $( "#year" ).val( ui.value );


    Where is my mistake?


    Cheers,
    Stoppelbo

  2. #2
    Join Date
    May 2004
    Location
    Manhattan NY
    Posts
    6,028
    Exactly what it says, you're missing a curly brace afterval( ui.value );
    And a closing parentheses:

    $("#slider").slider({
    min: 1990,
    max: 2008,
    value: 1990,
    step:1,
    change: slideyear( event, ui ) { $( "#year" ).val( ui.value ); }
    });

  3. #3
    Join Date
    May 2012
    Posts
    2
    After changing to this:

    function slideyear() {
    $("#slider").slider({
    min: 1990,
    max: 2008,
    value: 1990,
    step:1,
    change: slideyear( event, ui ) { $( "#year" ).val( ui.value );}
    });
    $( "#year" ).val( $( "#slider" ).slider( "value" ) );
    //update_date();
    }

    the error remains :-( Any other suggestions?

    Cheers,
    Stoppelbo

  4. #4
    Join Date
    May 2004
    Location
    Manhattan NY
    Posts
    6,028
    You're defining a function twice. First you declare it, then you try to call it with a second declaration after the call. That can't work.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles