This has been bugging me way too long. I am trying to create a click event within a function, which doesn’t seem to be working. Here is the basic layout:
function init() {
$('#a2').click(function() {
//does some stuff. Works fine.
$('#addDest').click(function() {
//does more stuff. Works fine…
if ($("#input2").is(':visible'))
{alert("test");};
});
});
};
The page is always assuming #input2 is visible! Even though it is switching on and off. I check in Firebug and it is able to know the truth. However, when I click on #input2, the alert ALWAYS pops up! I could throw my problem part outside of the function. But that will create more problems – as I will have some undeclared variables when the document loads. I am thinking I made this the long way and maybe event handlers or clickevents are a solution for more. But I am not quite at that level of understanding yet. I know it is reading that problem area, as when the page loads. Is there an easier solution to this issue? I know I prolly need to learn more... Thanks a lot!!
#a2, you want to reset the click event functionality on#addDest? Is that necessary?