How to get span tag inside a div in jQuery and assign a text?
Try this: $(“#message span”).text(“hello world!”); See it in your code! function Errormessage(txt) { var m = $(“#message”); // set text before displaying message m.children(“span”).text(txt); // bind close listener m.children(“a.close-notify”).click(function(){ m.fadeOut(“slow”); }); // display message m.fadeIn(“slow”); }