What am i doing wrong?

function error_msg(code)
{
  if (code=="pass")
  {
      alert(code); //pops/works
      $('#error').addClass("notification fail").fadeIn();  //does nothing
      $('#error').html('<strong>Incorrect Password</strong><span style="color:black"> - Please try again.</span>');//does nothing
  }	
}

Any help will be appriciated :-)

Recommended Answers

All 3 Replies

Yes, this should work. Do you have it live somewhere, where does it not work, are you sure there is an #error?

Is your JavaScript function wrapped in:

$(function() {
    // code goes here...
});

or

(function() {
    // code goes here...
})();

Use firebug to see what happen.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.