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' ); } } Link to comment https://forums.phpfreaks.com/topic/165063-jquery-issue/ 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; Link to comment https://forums.phpfreaks.com/topic/165063-jquery-issue/#findComment-870469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.