Use a form for URLs so you can hit enter to submit

This commit is contained in:
Ray Schamp 2015-05-06 14:59:37 -04:00
parent 227bda3d10
commit 4fbe39264b
2 changed files with 6 additions and 5 deletions

View file

@ -52,10 +52,10 @@
<p><a href="">What is a ScratchX URL?</a></p>
</section>
<section>
<div class="input-plus-button" data-action="load-url">
<form class="input-plus-button" data-action="load-url">
<input type="text" placeholder="paste url..." />
<button>Open</button>
</div>
<button type="submit">Open</button>
</form>
</section>
</dialog>

View file

@ -140,8 +140,9 @@ function sendURLtoFlash(url) {
}
}
$("[data-action='load-url'] button").click(function(e) {
sendURLtoFlash($(e.target).siblings('input[type="text"]').val());
$("[data-action='load-url']").submit(function(e) {
e.preventDefault();
sendURLtoFlash($('input[type="text"]', this).val());
});