在单选按钮中单击我必须获取customparamvalues。为此,在onclick
单选按钮上我编写以下代码
function myfunc(ele) {
var $tr = $(ele).parent().parent();
var name =$tr.find("td:eq(2)").html(); //alerts name its getting
var scripts = $tr.find("td:eq(3)").html(); //alerts scripts its getting
alert("Custom Param values.........."+$tr.find("td:eq(4)").html())
// it alerts my values 1:ONE<br>2:TWO<br> 3:THREE<br>4:FOUR
}
所以 $tr.find("td:eq(4)").html()
我得到了以下格式
1:ONE<br>2:TWO<br> 3:THREE<br>4:FOUR
我想要的是我必须以以下格式输出值,这怎么可能......
var val1 = 1;
var val2 =ONE
var val3=2
var val4=Two
..........
.............
我的html代码
joblist = joblist + "<table class='tablestyle'><tr><th class='thstyle'>Select</th><th class='thstyle' id='td_1'>Id</th><th class='thstyle'>Name</th><th class='thstyle'>Test Script</th><th class='thstyle'>CustomParamValues</th></tr>";
var tabString = '<tr ><td align="center" class="tdstyle"> ' + '<input type="radio" name="joblist" onclick="myfunc(this);" id= ' + value._id + 'value=' + value._id + '> </td><td id="td_1" align="center" class="tdstyle">' + value._id + '</td><td align="center" class="tdstyle">' + value.names + '</td><td align="center" class="tdstyle">' + value.script + '</td><td class="tdstyle">' + value.CustomParam1key + ':' + value.CustomParam1Value + '<br>' + value.CustomParam2key + ':' + value.CustomParam2Value + '<br> ' + value.CustomParam3key + ':' + value.CustomParam3Value + '<br>' + value.CustomParam4key + ":"+ value.CustomParam4Value + '</td></tr>';
joblist = joblist + tabString;