When a field is hidden with a field rule, its parent <li> has the classes "hidden" and "lf-container-hidden" applied to it, which cause it to not be displayed (display:none). The default display state is a 'list-item'.
I'm not sure if this is what you want, but the following JavaScript (see the below screenshot) will display alerts whenever the display status of the Field To Hide changes. You could use this as a starting point to carry out actions whenever a field's display status changes.
// Variables to hold current and previous display status
var previousViewStatus;
var currentViewStatus;
$( document ).ready(function() {
// Field 3 is the dropdown list. There are field rules associated with values within this list to show/hide the Field to Hide.
$( "#Field3" ).change(function() {
// Update previous state
previousViewStatus = currentViewStatus;
// Update current state
// q1 is the Field To Hide
currentViewStatus = window.getComputedStyle(document.getElementById('q1')).getPropertyValue('display');
// If the status have changed
if (previousViewStatus != currentViewStatus)
{
// If current status is not displayed
if (currentViewStatus == "none")
{
alert("Field is now hidden");
}
// If previous status was not displayed
if (previousViewStatus == "none")
{
alert("Field is now displayed");
}
}
});
});
