glenelkins Posted July 7, 2009 Share Posted July 7, 2009 Hi In the code below can anyone see why the alert('Hello') bit is not working?? ID of 'fact1' is set to 'New Fight' var didin_action = { timeOfLastAction:0, delayAction:0, blockAction:false, reviveTime:14500, gantiSelect:function() { // Get the selected action var action = $('fact1').value; // Select the function to use for the action switch ( action ) { case 'New Fight': didin_action.getGuard(); break; } }, getGuard:function() { alert ( 'Hello' ); } } Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted July 7, 2009 Share Posted July 7, 2009 Since you are trying to access a method within the same object change the following to see if it makes a difference: didin_action.getGuard(); to this.getGuard(); and also if it is jQuery and fac1 is an id you might want to change $('fact1').value; to $('#fact1').value; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.