java - JQuery Fetching the cell of the last row of a table and can we use autocomplete to hide some value in it -


my first query, code goes suppose table 5 rows , id = "mytable" , 3 cells in it

$("#mytable tbody tr:last td").each(function(i, td){     alert("value "+ "   "+i+"   "+td); }); 

now alert results iterate 0 3 , td [object htmltablecellelement]

now want value inside td tried td.html() jquery says td.html() not function

my second query regarding autocomplete

i have non primary key autocomplete , on basis of selection have fill in data. there way can hide primary key along autocomplete when user select autocomplete non primary key value, can primary key hidden field , fetch other data regarding value. code goes this

i have tried code in i'm putting primary key inside square brackets [] splitting , on basis of primary key m filling data there way can hide primary key totally. mean on mouse hover user displayed part rather inside autocomplete list.

e.g. abc [123]      abc [345] 

here abc actual autocomplete values n want hide primary key part distinguishes them rather displaying them in square brackets.

 $("#mytextbox").autocomplete({source: mylistitems,              change : function(event, ui) {                 var value = $("#mytextbox").val();                  var splitvalues = value.split('[');                  var last = splitvalues[1].lastindexof(']');                  var tail = splitvalues[1].substring(0,last);                  $("#mytextbox").val(splitvalues[0]);                 populateotherfields(response, tail);             },             select : function(event, ui) {                 var value = ui.item.value;                  var splitvalues = value.split('[');                  var last = splitvalues[1].lastindexof(']');                  var tail = splitvalues[1].substring(0,last);                  $("#mytextbox").val(splitvalues[0]);                 populateotherfields(response, tail);             }      });     function populateotherfields(response, tail){             // code populating other fields        } 

one more thing want add on selecting item autocomplete still displays complete string square brackets , after hitting tab button removes square brackets value. can tell missing or suggest other way of doing it. appreciated.

to fetch cellof last row in table

// first count total tr var i=$("#mytable tbody tr").length;  //then select last tr's td var lastrowtds=$("#mytable tbody tr").eq(i).('td'); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -