Saved X
Google login
SignUp with Email
X

How to call function in jquery

theindreshverma ( Edited  Sep 01, 11:19 pm )
Login

In jquery you can call a function using Html Events, using attributes like name, id, class

By event

<button onclick="Jqfunction()">By Event</button>

<script>
function Jqfunction() {
   alert('Jquery function');
}
</script>

By Class

<button class="byclass">By Class</button>

<script>
$('.byclass').click(function(){
   alert('By class');
});
</script>

By Id

<button id="byid">By Id</button>

<script>
$('#byid').click(function(){
   alert('By Id');
});
</script>

By Name

<button name="byname">By Name</button>

<script>
$('button[name="byname"]').click(function(){
   alert('By Name');
});
</script>

Sourcecode Tags

More Sourcecodes

More Sourcecodes