-4

Possible Duplicate:
JavaScript string newline character?

I'm a bit of a noob to PHP and JS and have a simple problem. I want the table to appear as soon as a selection is made and remove the enter button completely.

http://projectrepresentme.com/testpage/

I have a PHP script generating the table using an if loop.

How can I eliminate the Enter button?

Thanks in advance!!

0

3 Answers 3

1

HTML

<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$(document).ready(function() {
  $('select').change(function(){
    $('form').submit();
  });
});
<script>

But change the slectors for real ids or class.

Sign up to request clarification or add additional context in comments.

2 Comments

Your answer proved the most useful, but its still not working 100%. For some reason, it can't pull the PHP. It queries the PHP doc, but nothing is displayed? Any advice? projectrepresentme.com/testpage
You need run this code every time that you update the page.
0

Give the button a style of visibility: hidden and give the form an ID (I will be using myForm as the ID in my example), then use this Javascript (assuming jQuery):

$('#myForm select').change(function(){
    $('#myForm input').css('visibility','visible');
});

1 Comment

Thanks for the visibility tip. I'm 95% there. Any idea why I can't get the PHP to display now? projectrepresentme.com/testpage
0

I would recommend using a java-script library like jQuery to help. Once jQuery is part of your page you can add:

$('#formID input').hide(); //hides the "enter" button
$('#formID select').change(function(){ 
  //submits the form when a selection is made
  $('#formID').submit();
});

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.