I have first a with 3 option value in it. When I select one of the values, I want it to remember which one I picked and once I press my button the javascript will open a specific url.
Some code sample.
<select id="dd-files">
<option value="asdf">Pick:</option>
<option value="url1">File1</option>
<option value="url2">File2</option>
<option value="url3">File3</option>
</select>
</section>
</div>
<br>
<div class="modal-footer">
<a class="btn btn-primary get-data" href="#">Button</a>
</div>
javascript This javascript directily just to know how it all works, so I just tested it.
$(".get-data").on("click",function() {
var location = 'http://hardcodedurl.com';
window.open(location);
Then I have another function, which when I pick one option value, stores it and open it directly, but instead of open it directly, I would like my second script just to open when my button ".get-data" is pressed.
$(function () {
$('#dd-files').on('change', function() {
debugger;
var url = $(this).val();
if (url) {
window.location = url;
}
return false;
})
})
Any advice for a newbie?