change button color depending on text value, how??

change button color depending on text value, how??


I want to do the following (air code):

$('input[type=submit]').val('Update') then set submit button color=red
actual generated html looks like:
<input class="btn btn-primary" value="Update" type="submit">
<input name="products_id[]" value="1" type="hidden">

if an anchor link has a span class containing 'btn' and its text value is 'Check Out' then set color=purple
such as
$("span:contains('Check Out')").css("color", "purple"); (adapted from jQuery docs, this tests if span contains that phrase??)
actual generated span html looks like this:
<span class="btn btn-success">&nbsp;Check Out&nbsp;</span>

it's the css button color I want to change...

Any suggestions?? I'm generally familiar with jQuery but not enough in-depth familiar with the proper code/syntax I need...

Thank you, Tom