开发者

How to append new parameter to the url on slider slide action

I have a jquery slider

        slide:  function(e, ui){
        var value = $('#changeTableSlider').slider('value');
        $(this).attr("href",$(this).attr('href')+'&minSquaredAverage'=value);  
        }

On slider slide action I want to add new parameter to the 开发者_C百科current url. Firebug is currently giving me error on this like "invalid assignment left hand side". Need help please.??


The equal sign needs to be inside the single quote. You also need to use a + to concatenate the value of value on to the string. See below.

slide:  function(e, ui){        
    var value = $('#changeTableSlider').slider('value');
    $(this).attr("href",$(this).attr('href')+'&minSquaredAverage=' + value);
}


You need to move the = sign inside the single-quotes!


this is because you have an error here

$(this).attr("href",$(this).attr('href')+'&minSquaredAverage'=value

it should be

$(this).attr("href",$(this).attr('href')+'&minSquaredAverage=value');

otherwise you try to sum a string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜