javascript - jQuery if GET form conditional -


this question has answer here:

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>' ); 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)