I'm a bit confused regarding the dollar sign in jQuery, and was hoping someone could help me out.
I have the following function declaration:
$(function() {
$( "#create-discussion" ).button().click(function() {
alert("Clicked");
});
$( "#listitems tr" ).click(function(event) {
alert("clicked");
});
});
For some reason, the first function declaration for the "create-discussion" button works perfectly; when clicked, a popup appears. However, the second one does not work, and no popup is generated when I click on the table rows.
Is this some nuance in regards to button onClicks versus table row onClicks? Am I missing something stupidly obvious?
Also, I think it would help a bunch if someone explained what $(function() {})
actually does, as I'm treating it like $(document).ready()
, and I'm not sure if I can do that.
$("#listitems tr")
to$("#listitems tr td")
. (Just a thought.) – Hydrokineticsbutton()
function? – Hydrokinetics