Currently, I am working on a function that includes a conditional statement to display an alert when a specific class name is removed from a div layer. Below is the code snippet:
<div class="ui-tabs-panel ui-tabs-hide">panel</div>
<div><a href="#" class="control">control</a></div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js?ver=3.0"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
$('.control').hover(
function() {
$('.ui-tabs-panel').removeClass('ui-tabs-hide');
},
function() {
$('.ui-tabs-panel').addClass('ui-tabs-hide');
}
);
if ($('.ui-tabs-panel:not(.ui-tabs-hide)')) {
alert('hello');
}
});
//-->
</script>
The purpose of the "control" link and its associated function is solely to manage the addition and removal of the specified class name.
Currently, the alert pops up upon loading the page, which is not intended. This issue might be due to incorrect syntax usage in my code. Additionally, removing the ui-tabs-hide class from the div containing the "control" link does not trigger the alert as expected. It seems like I need to include some kind of event binder, but my knowledge of event binders is limited.
If anyone can assist me with this problem, I would greatly appreciate it.