I am having some trouble getting a function to work in internet explorer (7-8). My problem is that I need to hide some links until a user logs in, I would do this server side; however, suffice to say I have no way of doing this.
My approach has been to load a set of text (login/logout) that will change server side and test for the logout value. I was doing this by loading a div by id in Jquery and using the .text() when IE 7-8 both refuse to run this ie dev tools told me that “object doesn’t support this property or method” with a reference back to the line of code containing this lookup. Code posted below:
function logintest(){
login_test= "Sign out";
alert($('#log').text());
login = $('#log').text();
if(login.search(login_test) == -1){
$('#hiddenBox').css('display','none');
}
};
The fun thing is that the alert runs properly and displays the right text string. Upon this failing I tried using the .attr() and got identical results. Any help would be great!
Jquery version: 1.4.4
Site: http://www.brainwellnesspro.com
IE: 7-8 on win xp
Looking at your site I’d start by fixing the html to be valid, this isn’t good:
and since you already have jquery you can check the current text value of the login link like this