javascript - Select element that onchange is being triggered from - jQuery -
i trying create form when input has value put in , un-focused trigger event.
here code far.
$("#live-form input").on('change', function(e) { var value = $(this).val(); var key = $(this).attr("name"); $.post('update-form.php', {key:value}, function(data) { $("#form-status").html(data); }); });
and update-form.php script returns following response testing only:
key: key - value: value
when change jquery selector #username works fine. otherwise doesn't @ all.
html requested:
<div id="form-status"></div> <form id="live-form" action="" method="post" autocomplete="off"> <div class="form-contain"> <label for="username">username:</label> <input type="text" name="username" id="username" placeholder="username:" value="" maxlength="32" /> </div> </form>
Comments
Post a Comment