jquery, radio buttons, .html
I'm working with the following script but have clearly done something wrong.
I would expect "Select something." to show up initially in the #message div and then to be replace by something like "add_gallery button checked" as appropriate for the radio button selected.
Instead, nothing happens. What is wrong with my script?
Thanks,
--Kenoli
- <!doctype html>
- <html>
- <head>
- <title>Test Radio Select</title>
- </head>
- <body>
-
- <div id="select">
- <ul>
- <li><input type="radio" name="select" value="add_gallery" > Add a new gallery<br/></li>
- <li><input type="radio" name="select" value="change_name_gallery" > Change the name of a gallery<br/></li>
- <li><input type="radio" name="select" value="delete_gallery" > Delete a gallery<br/></li>
- </ul>
- </div>
-
- <p><div id="message" ></div></p>
-
- <script src="http://code.jquery.com/jquery-latest.min.js"></script>
-
- <script>
-
- $(document).ready(function() {
- // Initial content
- $(#message).html("Select something.");
- // New message when button checked
- if ($('#select ul li input:radio:checked')) {
- var value = $(this).attr('value');
- $(#message).html(value + " button checked.");
- };
-
- )};
-
- </script>
-
-
- </body>
- </html>