Link to home
Start Free TrialLog in
Avatar of peps03
peps03

asked on

Remove part of url

Hi,

I'm trying to remove the last part of an url, when a dropdown is changed, that looks like this:
edit.php?do=delete&id=x
The "X" needs to be replaced.

The code is use is:
$('#delemail').attr('href', function(index, attr) {
	var url1 = attr;
	url = url1.substring(0, url1.length - 1);
	return url + foo;
});

Open in new window


But this only removes the 'X'. So the first time it works fine, but if the "X" is replaced with an id, like 233, and the dropdown is changed again, the id will be: 23XXX

How do i completely replace the whole id onchange? (no matter how long the id is)

Thanks
ASKER CERTIFIED SOLUTION
Avatar of rrz
rrz
Flag of United States of America 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 peps03
peps03

ASKER

Thanks!!