Reputation: 1
I have exhaustively search the net for answers and have not found a single working solution as of yet. I have written numerous ways in attempt to change the label of a particular radio button.
I am trying to edit the default "Specify your own value:" to a custom text using the Script Editor in SharePoint 2013.
Here is the default code that SharePoint generates for you to give you an idea: Snippet Of Code from using F12 on IE
I am able to access it through CSS as so to test that the element indeed can be changed.
<style type="text/css">
span.ms-RadioText label[for="Number_x0020__x0028_Or_x0020_Ran_e6c9be8f-bccc-474a-8b0a-e9a136acbca7_$RadioButtonChoiceFieldFillInRadio"]{
// do whatever
}
</style>
Trying to access it through jQuery I have had no success.
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("label[for='Number_x0020__x0028_Or_x0020_Ran_e6c9be8f-bccc-474a-8b0a-e9a136acbca7_$RadioButtonChoiceFieldFillInRadio']").attr('.label', 'Assign #');
});
</script>
Please help or point out what I am doing wrong!
EDIT: I have tried numerous ways using the .text and .html with no avail from before.
.text("Assign #"); and .html("Assign #"); Changed nothing on SharepPoint.
Upvotes: 0
Views: 772
Reputation: 479
Try this,
HTML:
<div id="TheOptions">
<input type="radio" id="test1" name="mylist"/><label for="test1">option 1</label>
<input type="radio" id="test2" name="mylist"/><label for="test1">option 2</label>
<input type="radio" id="test3" name="mylist"/><label for="test1">option 3</label>
<input type="radio" id="test4" name="mylist"/><label for="test1">option 4</label>
</div>
jQuery:
$('label[for=test1]').html('best option');
Upvotes: 1
Reputation: 1
Try this:
$('label[for=Number_x0020__x0028_Or_x0020_Ran_e6c9be8f-bccc-474a-8b0a-e9a136acbca7_$RadioButtonChoiceFieldFillInRadio]')
.html('new label');
Upvotes: 0