Here is some HTML code that selects specific elements:
let array = jQuery.makeArray($(".dersprg tr td:nth-child(6)"));
The selected elements contain table header text and some irrelevant data. While I can interpret the irrelevant data using if statements and extract the necessary information, I encounter an issue when trying to push it to the array due to types not matching. The code snippet is shown below:
for(let i=0; i<array.length; i++){
let content = array[i].innerHTML;
if(some conditions){
array.splice(i--,1); //eliminate non day elements
array.push('test input <br>'); //problematic line
}
}
As you can see, I utilize innerHTML
to compare the content of the selected <td>
element, but adding some test input
results in the entire array becoming empty. I suspect this is due to a type mismatch, but I am unsure how to address this issue. Any assistance would be greatly appreciated.