In my table have dropdown. How to get text from dropdown?
In my table have dropdown. How to get text from dropdown?
whitewizard
Posts: 12Questions: 0Answers: 0
I'm beginner. This is my code
[code]
My Topic
Test1
Test2
[/code]
I want to click on button (id=bt). then get text from any objects in table
So. my question is...
How to get text from textbox (id=mytxbox) and dropdown (id=combobox)? and
How to implement function "getDetail()"?
Please help me. Thanks
[code]
My Topic
Test1
Test2
[/code]
I want to click on button (id=bt). then get text from any objects in table
So. my question is...
How to get text from textbox (id=mytxbox) and dropdown (id=combobox)? and
How to implement function "getDetail()"?
Please help me. Thanks
This discussion has been closed.
Replies
Use this code,
$('td select', this).change( function () {
alert($(this).val());
});
But i want to get text from all cells in a table when i click a button. do you have any idea?
Use the below code.
var aPos = oTable.fnGetPosition(this);
var aData = oTable.fnGetData( aPos[0] );
i see example of fnGetData at "http://datatables.net/api#fGetNodes"
The example show how to get and set text to a cell.
my problem is after i get text from a cell i must set text to a cell.. but in my cell . it's contain textbox. how i can set text in the textbox..
var row = oTable.fnGetData(0);
alert(row[0]);
it's get html code in a cell. such as the cell have a textbox.
the alert function must show
but i want to get "10" as a result. and want to set it to 20. Have any idea
Try this
$(row[0]).val('NEW VALUE');
Use this.
$('textId').val() = "20";
Use this.
$('textId').val() = "20";
codingavenue.. i try your solution but not work.
chandru.. Your solution is work! but i found a problem.. It can't set value to some object which are disappear in current page. Example.. i want to use below code
$('textId').val() = "20";
now current page is 1, but the object (textId) is appear in page number 2. the object not be set. Do you have any idea?
Can you send your code me?
I want to see your coding. After that I'll give suggestions.
[code]
// Global Variable
var oTable;
var setTable;
$(document).ready(function() {
oTable = $('#tablesorter-detail').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bSort": true,
"aoColumns": [
{ "sSortDataType": "dom-text", "sType": "numeric" },
{ "sSortDataType": "dom-label", "sType": "numeric" },
{ "sSortDataType": "dom-label", "sType": "numeric" },
{ "sSortDataType": "dom-text", "sType": "numeric" },
{ "sSortDataType": "dom-text", "sType": "numeric" },
{ "sSortDataType": "dom-label", "sType": "numeric" },
{ "sSortDataType": "dom-label", "sType": "numeric" },
{ "sSortDataType": "dom-text", "sType": "th_date" },
{ "sSortDataType": "dom-text", "sType": "th_date" }
],
"fnDrawCallback": function ( oSettings ) {
// This function is AddRowGrouping
if ( oSettings.aiDisplay.length == 0 )
{
return;
}
// Get Rows [Array]
var nTrs = $('#tablesorter-detail tbody tr');
var iColspan = nTrs[0].getElementsByTagName('td').length;
var sLastGroup = "";
for ( var i=0 ; i
[code]
function autoSetPromo{
$("#branchId1").val('9999999999');
}
[/code]
But if i change to below code
[code]
$("#branchId100").val('9999999999');
[/code]
It's not work.
$('tr').click( function() {
var oText = this.getElementByTag('input');
for(int i=0;i<=oText.length-1;i++)
{
if(oText[i].type == 'text')
{
oText[i].value = '100';
}
}
});