简体   繁体   English

从输入中获取值并将其设置到另一个输入框

[英]Take value from input and set it to another input box

I am using date range picker, here is the link of my codepen http://codepen.io/kylecraven1/pen/yaJZLk if you click on pick up date, you can see two calendars there, I want that second calendar input in drop off date box. 我正在使用日期范围选择器,这是我的代码笔的链接http://codepen.io/kylecraven1/pen/yaJZLk如果您单击提取日期,您可以在其中看到两个日历,我想要第二个日历输入截止日期框。

Here what I did, but it's not working 这是我所做的,但是没有用

$(".applyBtn").click(function(){
var myEndDate = $("input[name=daterangepicker_end]").val();
$("input[name=dropoffdate]").val(myEndDate);
});

Looks like you're assigning a string instead of the contents of myEndDate. 看起来您正在分配一个字符串而不是myEndDate的内容。 You should replace: 您应该替换:

$("input[name=dropoffdate]").val('myEndDate');

with

$("input[name=dropoffdate]").val(myEndDate);

Notice I've removed the quotes from myEndDate 注意,我已经从myEndDate删除了引号

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

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