Jump to content

Jquery/js Doubt


Recommended Posts

Posted

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}}
 
 
Posted

Text box ki oka class create chesuko

Onclick event lo

$(this).val

Rasuko

Posted

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

 

Posted

aa select ki id ivvu 

 

$("#dropdownid").val(); ante osthundi selecteditem value..

Posted

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;
        }
    }

Posted

Thank You all..this worked for me

 

 $(this).closest('li').find('input').val()

Posted

 

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();

 

});

Posted

 

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();

 

});

×
×
  • Create New...