I have this html
<div class="fake-input">
<input type="text" data-theme="a" placeholder="Card Number" id="ccnumber" name="ccnumber" class="textBox input tokenex_data" data-form="ui-body-a" />
<img id="cc" src="http://www.zermatt-fun.ch/images/mastercard.jpg" width=30 />
</div>
<div class="form-group" style="margin-left:0px">
<input type='hidden' id='ccType' name='ccType'/>
<ul class="cards">
<li class="visa">Visa</li>
<li class="visa_electron">Visa Electron</li>
<li class="mastercard">MasterCard</li>
<li class="maestro">Maestro</li>
</ul>
</div>
depeding on the value of the hidden input field ccType,I want to change the image src. Th below code is not syntactically correct,its just a demonstration and a raw idea of what im trying to do
if (ccType=="visa")
{
change the image src to 'www.xyz.com/visa.png'
}
if( ccType=="maestro")
{
change image src to 'www.xyz.com/masestro/png'
}
the src inside
<img id="cc" src="http://www.zermatt-fun.ch/images/mastercard.jpg" width=30 />
should be changed
Im trying to do this using a javascript.This is my fiddle