最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Getting the value of a slider in Jquerymobile? - Stack Overflow

programmeradmin1浏览0评论

I am unable to get this to work in jquerymobile I am getting null on the weightvalue variable :

JS

$("#submitWeight").on('click', function(e) {
    e.stopImmediatePropagation();
    e.preventDefault();

    submitWeight(e);
}); 

function submitWeight(e){

    var weightMonth = $("#selectMonth option:selected").text();
    var weightValue = $("#sliderWeight").slider( "option", "value");

    alert("Done");
} 

HTML

<input type="range" name="slider" id="sliderWeight" value="60" min="0" max="100" data-theme="c" >

I am unable to get this to work in jquerymobile I am getting null on the weightvalue variable :

JS

$("#submitWeight").on('click', function(e) {
    e.stopImmediatePropagation();
    e.preventDefault();

    submitWeight(e);
}); 

function submitWeight(e){

    var weightMonth = $("#selectMonth option:selected").text();
    var weightValue = $("#sliderWeight").slider( "option", "value");

    alert("Done");
} 

HTML

<input type="range" name="slider" id="sliderWeight" value="60" min="0" max="100" data-theme="c" >
Share Improve this question edited May 27, 2013 at 21:45 Gajotres 57.3k16 gold badges105 silver badges131 bronze badges asked May 27, 2013 at 13:34 kolexinfoskolexinfos 1,0021 gold badge21 silver badges44 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Working example: http://jsfiddle/Gajotres/s33tX/

$(document).on('pagebeforeshow', '#index', function(){ 
    alert($("#sliderWeight").val());
});
发布评论

评论列表(0)

  1. 暂无评论