I have a issue in my js file. This is my Js Code.
<script type="text/javascript">
$(document).ready(function()
{
$(".abc").click(function()
{
$(this).addClass('testingClass');
});
$(".testingClass").click(function()
{
alert("hiiiiiiiiiiiiiiiiii")
});
});
</script>
My HTML :
<button class="abc">Demo</button>
When i load this page in Browser, The addClass function is successfully executing and adding new class named "testingClass".
But When Try to click again t that button (meens : class="testingClass") the alert function does not working. What is the error.
Is JS is not supporting frequent execution of an element ? Anybody Please help me.
Steps..
- One Button has class named abc
- When click on it an ajax function will storing current time in database.(ajax function not in stack-code).
- after successful ajax response the button class changed to testingClass.
- now the class name of the button is testingClass
- After some time Click on the Button again (class named:testingClass), i want to call a ajax function with current time of click and store the values in database.
- Then the Button class name will changed to old ( abc).