I am having an issue where IE is not working with the following code. The code basically hides a div if elements are empty, you will notice it works in all but IE.
//hide webapp item if empty
if ($("#features").html().trim()) {} else {
$("#f-h").hide()
}
if ($("#application").html().trim()) {} else {
$("#a-h").hide()
}
if ($("#tech-specs").html().trim()) {} else {
$("#t-h").hide()
}
if ($("#downloads").html().trim()) {} else {
$("#d-h").hide()
}
if ($("#custom-field").html().trim()) {} else {
$("#c-f").hide()
}
The pages to see it in action is webpage
Any hints to why ie doesnt like this or a better method would be appreciated.
jQuery
html()method just returns a string containing the HTML.JavaScript strings don’t have a
trim()method.If you want to introduce one to the javascript’s String object. You can do so with:
^^^ didn’t test this, but I am pretty sure it will do the job.