Jump to content

jQuery Issue


glenelkins

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.