简体   繁体   English

使用表单字段输入来设置everythingSlider值

[英]Use a form field input to set an anythingSlider value

I can't seem to figure out how to make a form input box such that when you click a submit button, the value of that input box is updating this slider 我似乎无法弄清楚如何制作一个表单输入框,这样当您单击提交按钮时,该输入框的值将更新此滑块

http://css-tricks.com/anythingslider-jquery-plugin/ http://css-tricks.com/anythingslider-jquery-plugin/

$('#myForm').click ( function() { $('#slider').anythingSlider(formVal); } )

After reading your comment and fixing your question, I think you mean 阅读您的评论并修正问题后,我认为您的意思是

<script>
$(document).ready(function() {
  $('#myButton').click(function() { 
    $('#slider').anythingSlider($("#myField").val()); 
  })
});
</script>
<form>
<input type="text" id="myField" value="" />
<input type="button" id="myButton"/>
</form>

Create an input box and a button in html body 在HTML正文中创建一个输入框和一个按钮

<form>
  <input id='input1' name='input1' />
  <input type='button' value='Submit' id='submit' onclick='onSubmit()' />
</form>

Add this function to your javascript 将此功能添加到您的javascript

function onSubmit() {
  formVal = document.getElementbyId('input1').value
}

For your case, use JQuery as 对于您的情况,请使用JQuery作为

$document.ready(function() {
  $('#submit').click(function() {
    var formval = $('$inpupt1').val();
    $('#slider').anythingSlider(formVal); 
  });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM