Cant explain why it works on its own, but try this

$(document).ready(function () {

if(window.location.href.indexOf("w3schools") >= 0)

{

alert("Welcome to W3 Schools!");

}

});

 

From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf
Of Paul Noone
Sent: Thursday, 7 July 2011 12:06 PM
To: ozMOSS (ozmoss@ozmoss.com)
Subject: Using indexOf within document ready function

 

Just slightly OT but can someone please tell me why the following fails when
run within the document ready function but works as expected when it's on
its own?

I've tried dozens of variations and the result is always the same. This
should just work and I can't find anything that says otherwise.

$(document).ready(function () {

if(window.location.indexOf("w3schools") >= 0)

{

alert("Welcome to W3 Schools!");

}

});

_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to