My HTML code:
<div class="span-6">
<p>
<table id="symptomTable" class="symptomsTable hidden"><th>Selected Symptoms:</th><tr></tr></table>
</p>
</div>
My CSS:
.hidden
{
display : none;
}
And lastly my javascript:
$('#addSymptom').click(function()
{
if($('#symptomToBeSearchedTitle').val()=="")
{
alert('You need to select a symptom.');
}
else if($('#dateSymptomSeen').val()=="")
{
alert('You need to select the date the symptom was first seen on.');
}
else
{
//create new symptom in javascript
var newSymptom =
{
symptomCode: $('#symptomToBeSearchedCode').val(),
dateSymptomFirstSeen: $('#dateSymptomSeen').val(),
symptomTitle: $('#symptomToBeSearchedTitle').val()
};
//create new object for symptom code
symptomCodesQueryString = symptomCodesQueryString+"&symptomCode[]="+newSymptom.symptomCode;
//pass new symptom into symptomsList array
symptomsList.push(newSymptom);
//increase counter
counter++;
//empty input
$('#symptomToBeSearchedCode').val("");
$('#symptomToBeSearchedTitle').val("");
//append symptoms table
$('#symptomTable tbody').append('<tr class="child"><td>'+newSymptom.symptomTitle+'</td></tr>');
$('#symptomTable').removeClass("hidden");
}
});
My entire script works perfectly fine, EXCEPT for that final command
$('#symptomTable').removeClass("hidden");
that does not execute at all. I check the console in firebug and no errors are coming up. Can anyone help me find a way to fix this? I tried using show() too, it doesn't work either. Thank you for your time.
.show()and.hide()methods.<table><th></th><tr></tr></table>$('#symptomTable tbody').append(...You have no tbody. How then is this code working?