I am trying to use jQuery to do something like
if(jQuery(\'#id\').click) {
//do-some-stuff
} else {
//run function2
}
But I\'m unsure h
You may actually mean hovering the element by not clicking, right?
jQuery('#id').click(function()
{
// execute on click
}).hover(function()
{
// execute on hover
});
Clarify your question then we'll be able to understand better.
Simply if an element isn't being clicked on, do a setInterval
to continue the process until clicked.
var checkClick = setInterval(function()
{
// do something when the element hasn't been clicked yet
}, 2000); // every 2 seconds
jQuery('#id').click(function()
{
clearInterval(checkClick); // this is optional, but it will
// clear the interval once the element
// has been clicked on
// do something else
})
This is all you need: http://api.jquery.com/click/
Having an "else" doesn't apply in this scenario, else would mean "did not click", in which case you just wouldn't do anything.