简体   繁体   中英

input “value” is changing the output

Pick 2 dates, calculate the total day difference between 2 dates and append it in #finaldays however somethig happens:

As I set value to input:

<input id="from" value="justAvalue" />

I get some unexpected result(negative num appears as you select later dan 14th), see(problem): http://jsfiddle.net/9EZXx/5/

If I just remove the value:

<input id="from" /> 

I just get the expected result, see: http://jsfiddle.net/f2hL6/1/

How does value of input change the situation?

"result must be: select date1 and as date2 selected output the result"

Try using placeholder instead of value

<input id="from" placeholder="aa" />
<input id="to" placeholder="aa" />
<div id="finalDays"></div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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