jquery - Selecting the row with the twitter type ahead and updating values in the same row -


i have table of text field bind twitter type ahead this.

failed bind twitter bootstrap typeahead jquery generated rows text fields

i want result of selection type ahead displayed in next text fields in same row(nth row). first row updated tried this.

$('#mytable').find('tr').click( function(){    $(this).find('#mytext1').val(val1);    $(this).find('#mytext2').val(val2); } 

but needs additional click after selection made , duplicates result of last row selected. can , suggest how handle situation?

changed code this

$('#mytext0').live('change', function(){        //ajax call based on user selection of mytext0, twitter bootstrap bind        $(this).closest('tr').find('#mytext1').val(val1);        $(this).closest('tr').find('#mytext2').val(val2); }); 

but not working closest doesn't know method find. ideas??

i figured out using blog tatiyants @ http://tatiyants.com/how-to-use-json-objects-with-twitter-bootstrap-typeahead/ , in updater called method update other fields in table based on user selection here goes method:

function getdetail(id) {     var $selected;     $('#mytext0').live("change keyup", function (){      $selected = $(this).closest("tr");    });    $.ajax({      //make post based on id server , upon success      success: function(result){          $selected.find('#mytext1').andself().filter('#mytext1').val(result);          $selected.find('#mytext2').andself().filter('#mytext2').val(result);       }             }) } 

this has solved fact result updating first row.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -