How do you change the text for all within the a
to
continue reading
using jquery
$('.post-read a').html("continue reading")
This should do it:
$('.post-read a').html('continue reading');
Through the text property in jQuery that changes the inner text of the <tag>
$(document).ready(function () {
$('.postread a').text("your new text here ");
}
Do it with jQuery inside of a document ready handler ($(fn)
)...
$('.post-read a').text('continue reading');
jsFiddle.
For the sake of it, here is how to do it without jQuery....
var anchor = document.getElementsByClassName('post-read')[0].getElementsByTagName('a')[0],
textProperty;
if (anchor.textContent) {
textProperty = 'textContent';
} else if (anchor.innerText) {
textProperty = 'innerText';
}
anchor[textProperty] = 'continue reading';
jsFiddle.
This will work good for your piece of HTML, but it isn't too generic.
If you don't care about setting innerText
property, you could use...
anchor.textContent = anchor.innerText = 'continue reading';
I wouldn't recommend it though.