I was wondering how can I set an event’s target action correctly? Inside an event handler function in javascript, I have
alert(e.target.getAttribute('action')); // Outputs correctly
alert(newAction); // Outputs newAction correctly
e.target.setAttribute('action',newAction); // Seems to be the problem
alert(e.target.action); // INCORRECT: Has some url prefixed to newAction
The new action alert shows some url+newAction, but I just want newAction. Any help with this would be greatly appreciated. Thanks.
Try
alert(e.target.getAttribute('action'))