http://jsbin.com/uxepap/3/edit
Here is div with links inside. I'm trying to replace comma inside last <a>
with point "."
This comma comes from numeral sort of the list, should be replaced with point.
The problem is, all links stored inside links
var, not sure how to get the last one and then replace it.
Any thoughts?
Use String.replace
var links = $('a');
var $last = links.filter(":last");
$last.html( $last.html().replace(",", "."));
links.eq(-1).html(function(index, value) {
return value.replace(/,\s*$/, ".");
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.