Do you know why this method click doesn't show alert? Because I'm not able to catch this event.
<!DOCTYPE html>
<html>
<head>
<script src="jquery.js"></script>
<script>
jQuery(function () {
jQuery(".jtable-command-button.jtable-edit-command-button").click(function () {
alert("asdas");
});
});
</script>
</head>
<body>
<h1>My First JavaScript</h1>
<p id="demo">This is a paragraph.</p>
<button class="jtable-command-button jtable-edit-command-button" title="Edytuj pozycję">
</body>
</html>
I give you for all of you points for help [closed] thanks
$ function (probably from jQuery) without defining it (e.g. by loading jQuery)id selector but the element doesn't have an id (it does have a class) (Note: after the first edit of the question, this is no longer the case)descendant combinator and a type selector, but the type should be a class and the element you are targeting belongs to both classes. It doesn't have an ancestor element which is a member of either of the classes. (Note: The HTML class attribute takes a space separated list of classes)A fixed version of the JS part would be:
<script src="jquery.js"></script> <!-- Set this path correctly -->
<script>
jQuery(function () {
jQuery(".jtable-command-button.jtable-edit-command-button").click(function () {
alert("asdas");
});
});
</script>
You have class name, so class selecter starts with . in jquery.
$(".jtable-command-button.jtable-edit-command-button").click(function () {
alert("asdas");
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With