Link to home
Start Free TrialLog in
Avatar of splanton
splantonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Quick JQuery syntax issue

Hi,

I've got a line of Jquery code to find the text value of a selected item in a drop down list:

		var currentId = $(this).attr('id').substring(5);
		if ($('#feeid + currentId option:selected').text() == 'My Fee Is') {

Open in new window


It doesn't work, however this does:

		var currentId = $(this).attr('id').substring(5);
		if ($('#feeid1 option:selected').text() == 'My Fee Is') {

Open in new window


So using the '+ currentid' is causing the issue. I have confirmed the currentid has a correct value. How do I code this? I have searched the internet but it's so specific I can't find an answer that helps me.

I am assuming that you can place the '#feeid + currentId' in some parenthesis? I may be totally wrong though. :)

Regards
ASKER CERTIFIED SOLUTION
Avatar of Alexandre Simões
Alexandre Simões
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of splanton

ASKER

Ah! - a bit obvious now I can see the solution - but isn't that always the case?
Many thanks,

Regards