javascript - jQuery if GET form conditional -
this question has answer here:
- how value parameters? 43 answers
i have following code:
$( 'body' ).replacewith( '<iframe src="http://google.com" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px" height="100%" width="100%"></iframe>' );
it replaces whole content of page iframe. above code vary iframe source if form sent specific value.
for example if:
<input name="any_other_value" value="any_value" type="radio">
is selected, jquery code posted above shows different iframe.
do think can achieved jquery?
this code looks see whether radio button checked. if so, src
of iframe
adjusted.
var desiredsrc = 'http://google.com' if($('input[name="any_other_value"][value="any_value"]').is(':checked')) desiredsrc = 'http://example.com' $( 'body' ).html( '<iframe src="' + desiredsrc + '" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px" height="100%" width="100%"></iframe>' );