When an hidden input has a value that contains the letters "LO" I want to replace a button inside a form with some different html.
HTML:
<input type="hidden" name="LO123456" id="hiddenCode" value="LO123456" />
<input type="text" name="quantity" id="formProductQuantity" value="1" />
<a class="button green" href="#" onclick="$('#form').submit(); return false;">Add to cart</a>
So in above example the hidden field has "LO" in it, so how can I replace the button with
<a class="button green" href="some.html">More information</a>
What I tried:
if ($( "input[value*='LO']" ).find('.button').replaceWith('<a class="button green" href="some.html">More information</a>'));
That doesn't work though because it replace also the buttons without "LO" in the hidden field.
Any help greatly appreciated!
UPDATED
I've updated the code because there's another input field which I didn't mentioned!
ifstatement at all -- it's a no-op.