I am trying to replace spaces in hyperlink text with hyphen(-).
Below is my anchor tag :
<a href="${user.workstation}"></a>
and I want some something like this :
<a href="replace(${user.workstation}, " ", "-")"></a>
Please advice.
I am trying to replace spaces in hyperlink text with hyphen(-).
Below is my anchor tag :
<a href="${user.workstation}"></a>
and I want some something like this :
<a href="replace(${user.workstation}, " ", "-")"></a>
Please advice.
Please try this
var corrected = $('a').attr('href').replace(/ /g,'-');
$('a').attr('href' , corrected );
The replace() method searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced.
g Perform a global match (find all matches rather than stopping after the first match)