Very basic question on .css() as a setter
Hello everyone, I'm a complete beginner. I hope to be clear in what I am going to ask.
I need to modify an existing mixed html+PHP page containing a login form. What I want to achieve is to signal a bad login attempt through a message in a
<span id="error">sometext</span>
element.
I think that it should be hidden when the page loads so I've put
$(function() {
$("#error").css('display','none');
});
into the body of the page before the <span> element is encountered.
Than, on login error, I want to display the <span> element so I use
<script>
$("#error").css('display','inline'); // or maybe $("#error").css('display','');
</script>
The page source looks like this:
[...]
<script>
$(function(){
$("#error").css('display','none');
});
</script>
[...]
<form action="<?php print $this->url() ?>" method=post>
[...]
</form>
<span id="error">Wrong Userid or Password.</span>
[...]
<?php if (login_error) { ?>
<script> $("#error").css('display':'inline');</script>
<?php } ?>
But this isn't working for me...is this a completely wrong approach or am I just missing some detail?
Tahnks,
Fabio.