Space in the class name
Space in the class name
I have a simple datatable and I have assigned class names to each of the columns. My issue is that when I inspect the element in Firebug I notice it's prefixing each class name with a white space, I have no idea where it's coming from.
This discussion has been closed.
Replies
Allan
Thanks for your response. So now the problem is that I am now being able to get the value of that column due to that space. This is my code ...can you please suggest the best way to get to the id ?
srch2 = "#Project_scope";
$('#projscope table').ready(function() {
var oTable = $(srch2).dataTable({
"aoColumns":[{ "sWidth": "10%", "sTitle": "EmpID", "sName":"EmpID", "sClass":"EmpID" , "aTargets": [ 0 ],},
{ "sWidth": "10%", "sTitle": "Product", "sName":"Salary", "sClass":"Salary"},
],
"bJQueryUI":true,
"bPaginate":true,
"bLengthChange":true,
"bFilter":true,
"bSort":true,
"bInfo":true,
"sPaginationType":"full_numbers",
"bAutoWidth":true,
"bSortClasses":false,
"aaSorting": [[0,'desc']],
"fnDrawCallback":function(oSettings) {
$('#Project_scope tbody tr').bind('click', function () {
var empid = $(this.parentNode.parentNode).children(".EmpID").text();
alert (custid);
});
}
});
});
So this code would not work (actually on first load sometimes it did! Before the class was effected):
[code]
$('table').on('mouseover', 'a', function(e){
if( class_name = $(this).parent().attr('class') == 'name' ){
// do something
}
})
[/code]
This might have someone bug hunting so it would be good to 'fix'. There is an easy work-around:
[code]
$('table').on('mouseout', 'a', function(e){
var class_name = $(this).parent().attr('class');
if( class_name == 'name' || class_name == 'name ' ){
// do something
}
})
[/code]
Allan