Hide or remove based on content of different div onLoad?
I'm pretty new to jscript and jquery (long-time PHP programmer, though) and I'm stuck with how to properly evaluate a value in a document onLoad. Caveat - I am working on this via a CMS (BusinessObjects), so don't have 100% control over what's passed in to the page.
HTML:
<div id="home_alert"><hr />
<p><a href="/member-home.htm">LOG IN to read new items!</a></p>
<div id="member-alert-announce">{module_announcement,i,31801,true,,}</div>
if {module_announcement,i,31801,true,,} is "empty" it generates "No announcements found."
What I
want to do is evaluate "member-alert-announce" and if its value = "No announcements found." I want the div home_alert to not show on the page. I never want the value of member-alert-announce to appear on this page - it's just a trigger for the home alert message to appear.
I've tried both hide() and remove() to accomplish this. I cannot get the value of #member-alert-announce to be correctly evaluated at all.
My jquery is:
var alertyes = ("#member-alert-announce");
if (alertyes == "No announcements found.") {
$("#home_alert").hide();
$("#member_alert_announce").hide();
All suggestions will be gratefully accepted! This is frustrating!!!
Thanks
K.