Basically I am building a html banner that can be posted in blogs or on other webpages. All it is is a form with some options in a select element.
<form id='formElement' method='get' action='#'>
<select id='selectElement'>
<option value='united-kingdom'>UK</option>
<option value='ireland'>Ireland</option>
</select>
</form>
This jQuery takes the value of the selected option, and then adds the value on the end of A URL and then opens the url.
$(function() {
$("#selectElement").change(function() {
if ($(this).val()) {
var country = $(this).val();
window.open("http://www.mobell.co.jp/country/"+country+"/", '_parent');
$("#formElement").submit();
}
});
});
});
This works fine if I preview and use the banner locally, but if I embed the banner in a blog post then when the form submits it just goes to the homepage of that URL.
Any ideas?
For some reason it works fine on js fiddle: http://jsfiddle.net/5pSTz/
I have added the input form in an iframe, seems to work fine now, thanks anyway