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.
精彩评论