I'd like to be able to reach out into the following html structure
<div id="collection_propID214_formID1">
<p class="fieldHeaderContainer">
<strong>Add by ID:</strong>
</p>
</div>
And change the text inside of tag, using jQuery. Is this possible?
We can use the jQuery text() function to get the value of the bold tag. If we want to get values of all bold tags then we can use each() loop that will select all bold tags one by one.
addClass("boldText"); *Note about the use of ! important : This is usually not recommended CSS as it's often used in the wrong way. However in this case if you add a class called boldText to an element, chances are, you will always want it to have bold text.
You could use $('. gettext'). text(); in jQuery.
You could change the text of the strong
tags inside the div
using .text()
.
Try this:
$('#collection_propID214_formID1 strong').text('Your text here');
JSFiddle Demo
Or
$('#collection_propID214_formID1').find('strong').text('Your text here');
P.S: If there are more than one strong elements, this would change the text for all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With