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:
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
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;
});
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER