Osama Bin Gandhi Posted April 24, 2014 Report Posted April 24, 2014 Nenu oka View lo foreach loop tho oka list (li tag) create chestunna...(based on # of rows i get from DB) So I list lo I have textbox(date picker) and button. List can contain multiple rows... How can I get textbox date value of a selected listitem upon save button click in the same list. i tried this but 1st list item value ostundi.. {{#each this}} <li class="alertlistitem" data-alert="{{student_id}}"> <input type="date" name="datealert" id="datealert" value="{{alert_date}}" <a id="monthly_alert" class="button big accept anchor" onclick="monthlyalert({{student_id}},datealert.value);" ></span>Save</a> </li> {{/each}}
andhrabullet Posted April 24, 2014 Report Posted April 24, 2014 Text box ki oka class create chesuko Onclick event lo $(this).val Rasuko
Osama Bin Gandhi Posted April 24, 2014 Author Report Posted April 24, 2014 ala ina 1st list value ee choopistundi.. ippudu c# lo laga...listitem.Selectedindex.Value ala emanna untunda?? Text box ki oka class create chesuko Onclick event lo $(this).val Rasuko
ILAQAT_MUFLIYA Posted April 25, 2014 Report Posted April 25, 2014 aa select ki id ivvu $("#dropdownid").val(); ante osthundi selecteditem value..
kick_seenu Posted April 25, 2014 Report Posted April 25, 2014 Try this bhayya -- yo can get the value and also compare and do something else.... general ga vesa $(function () { $("#yourID").change(function () { resetHours(); }); }); function resetHours() { if ($("#yourID option:selected").text() == "Name 1") { xyz; } if ($("#yourID option:selected").text() == "Name 2") { xyz; } if ($("#yourID option:selected").text() == "Name 3") { xyz; } }
Osama Bin Gandhi Posted April 28, 2014 Author Report Posted April 28, 2014 Thank You all..this worked for me $(this).closest('li').find('input').val()
afdbzindabad Posted April 28, 2014 Report Posted April 28, 2014 Nenu oka View lo foreach loop tho oka list (li tag) create chestunna...(based on # of rows i get from DB) So I list lo I have textbox(date picker) and button. List can contain multiple rows... How can I get textbox date value of a selected listitem upon save button click in the same list. i tried this but 1st list item value ostundi.. {{#each this}} <li class="alertlistitem" data-alert="{{student_id}}"> <input type="date" name="datealert" id="datealert" value="{{alert_date}}" <a id="monthly_alert" class="button big accept anchor" onclick="monthlyalert({{student_id}},datealert.value);" ></span>Save</a> </li> {{/each}} $('#monthly_alert').click(function(){ $(this).closest('li').find('#datealert').val(); });
SAbidda01 Posted April 28, 2014 Report Posted April 28, 2014 Nenu oka View lo foreach loop tho oka list (li tag) create chestunna...(based on # of rows i get from DB) So I list lo I have textbox(date picker) and button. List can contain multiple rows... How can I get textbox date value of a selected listitem upon save button click in the same list. i tried this but 1st list item value ostundi.. {{#each this}} <li class="alertlistitem" data-alert="{{student_id}}"> <input type="date" name="datealert" id="datealert" value="{{alert_date}}" <a id="monthly_alert" class="button big accept anchor" onclick="monthlyalert({{student_id}},datealert.value);" ></span>Save</a> </li> {{/each}} first nevu for loop lo ID nee assign cheyatam apu bhaya or id value end nee increment chesukunta vellu. you cant have same id for multiple elements. $('#monthly_alert').click(function(){ $(this).closest('li').find('#datealert').val(); }); yee logic lo problem ente ante. you cant have same id for multiple elements. for loop lo atanu id nee set cheya kudadu $(this).closest('li').find("input[type='date']").val(); });
Recommended Posts