In my application I want to change the src value of iframe on click of radio button But when I try to do that I got error as:
ReferenceError: Left side of assignment is not a reference
Here is my html code as:
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-type="horizontal">
<input id="aaa" name="exch_type" type="radio" value="AAA" checked="checked"/>
<label for="aaa" style="width: 125px;">AAA</label>
<input id="bbb" name="exch_type" type="radio" value="BBB" />
<label for="bbb" style="width: 125px;">BBB</label>
</fieldset>
</div>
</div>
<div align="center">
<iframe name = "chartId" id = "chartId" src="http://myDomain/chts/mobile.asp?Scrip=AAA&Exchange=XXX&ChartType=I&Hg=150&Wd=300" scrolling="yes"></iframe>
</div>
And click function as
$('input[name=exch_type]').change(function()
{
var radio_val = $('input[name=exch_type]:checked').val();
if (radio_val=="AAA")
{
$("#chartId").attr("src") = "http://myDomain/charts/mobilechart.asp?Scrip=AAAIND&Exchange=NSE&ChartType=I&Hg=150&Wd=300";
}
else if (radio_val=="BBB")
{
$("#chartId").attr("src") = "http://myDomain/charts/mobilechart.asp?Scrip=BBBIND&Exchange=NSE&ChartType=I&Hg=150&Wd=300";
}
//alert('Radio Value: '+radio_val);
});
Any help will be appreciated Thanks in advance
I’ve not tested but, note a bad assignment:
instead of: