javascript - how to put two text inputs values to hidden input -
my html:
<li style="display: none;"> <span class="add-on"></span> <input class="" type="text" value="" style="display: none;"> <input class="" type="hidden" name="biology" value="" style="display: none;"> <input class="datepicker" type="date"> </li> <li> <span class="add-on">ecconomics</span> <input class="ecconomics" type="text" value=""> <input class="ecconomics" type="hidden" name="economics" value=""> <input class="datepicker" type="date"> </li> <li> <span class="add-on">business study</span> <input class="business study" type="text" value=""> <input class="business study" type="hidden" name="business studies" value=""> <input class="datepicker" type="date"> </li>
my jquery:
$(document).on('keyup', function() { var getdate = $(".datepicker").val(); var getmark = $("li > span + input").val(); var plusval = getdate + getmark; $(".picker").val(plusval); });
i want put .datepicker
class value , first text input value hidden input value using javasscript/jquery. trying using above code no luck. have many <li>
tags contain above 3 inputs text, hidden , datepicker. how do that?
loop through each li element , grab inputs inside, like:
$('li').each(function(){ var self= $(this); var getdate= self.find('.datepicker').val(); var getmark= self.find('span + input').val(); var plusval = getdate + getmark; self.find('.datepicker').val(plusval); })
it's not optimized or tested. idea.
Comments
Post a Comment