DiyanDesigns DiyanDesigns - 8 months ago 42
Javascript Question

Remove part of url in spesific class

I am using a module for joomla called RokMiniEvents but there is a problem, once you use the navigation it adds a path to the events url: "/modules/mod_rokminievents3"..

Let's say the working url is this :

<a class="rme-title" href="/td/index.php/component/jevents/icalrepeat.detail/2014/07/22title=proto-seminario/0/-/-?rp_id=2&amp;Itemid=0">Event name</a>

But once you use the Navigation it becomes:

<a class="rme-title" href="/td/modules/mod_rokminievents3/index.php/component/jevents/icalrepeat.detail/2014/07/22title=/0/-/-?rp_id=2&amp;Itemid=0">Πρωτο Σεμιναριο</a>

I would like to use something like:
where a with class="rme-title" replace the /mod_rokminievents3 with nothing..

Is that possible with javascript or any other language ? I've seen a lot of answers here but without the class selection..

-Thank you.


Select the elements and replace that part of the href with nothing using String.replace

$('a.rme-title').attr('href', function(_, href) {
    return href.replace('/mod_rokminievents3','');