javascript - Jquery input value not showing up correctly -
i have simple input value.
the code looks this:
var $a = $('.custom-amount').val(); $('.custom-amount').on('change', function() { alert($a) })
and input:
<div class='custom-amount'> <input placeholder='custom amount' type='text-area'>
for reason, alerts empty. see whats going wrong?
change selector $('.custom-amount input')
, , value after alter event fired, e.g.
$('.custom-amount input').on('change', function() { var = $(this).val(); alert(a); });
right now, trying value of div
, won't work. need value of input.
edit: also, looks trying display textarea
. seek replacing this...
<input placeholder='custom amount' type='text-area'>
with this...
<textarea placeholder='custom amount'></textarea>
this may help:
http://jsfiddle.net/d648wxry/
javascript jquery html
No comments:
Post a Comment