I have a very simple JavaScript operation which is just not working. I’m using the twitter-bootstrap CSS, and am attempting to implement the close of the close message box. I have my code here:
HTML
<div class = "alert-message success" id = "message_1">
<a class = "close" href = "#">x</a>
</div>
JavaScript
function hideSomething(which_thing)
{
$(which_thing).hide();
}
$(".close").click(function()
{
hideSomething("#" + $(this).parent().attr("id"));
});
Essentially I want the same “close” class of link to hide the div when clicked – hence the request for the parent id. But even though jslint tells me my code is valid – it still doesn’t work.
Any ideas on how to solve this would be greatly appreciated.
Try this, I just removed the js lint and it works.
http://jsfiddle.net/YQgpe/15/