Jump to content

kenoli

Members
  • Posts

    33
  • Joined

  • Last visited

About kenoli

  • Birthday 09/24/1944

kenoli's Achievements

Newbie

Newbie (1/7)

1

Reputation

  1. Thanks for the replies. I was clearly very off base. I fixed things with the following code: <!doctype html><html> <head> <title>Test Radio Select</title> </head> <body><div id="select"><ul><li><input class="clown" type="radio" name="select" value="add_gallery" > Add a new gallery<br/></li><li><input class="clown" type="radio" name="select" value="change_name_gallery" > Change the name of a gallery<br/></li><li><input class="clown" type="radio" name="select" value="delete_gallery" > Delete a gallery<br/></li></ul></div><p><div id="message" ></div></p><script src='http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js' ></script><script>$(document).ready(function() { // Initial content $('#message').html('Select something.'); // New content $("input[name='select']").on( "click", function() { var page = $(this).attr('value'); //alert(page); // Debug //$("#message").html(page + " was selected!" ); // Debug $("#message").load('content/' + page + '.php'); });});</script> </body></html>
  2. Thanks for catching the syntax issues. The rest makes sense. I get very confused about selectors. I was not sure how to select for "checked". What you have to say helps clarify what creates a focus that "this" can relate to. Essentially what you are saying here is that there needs to be an event triggered before there is an element to refer to with "this." Is that correct? Why does checking the radio button not consist of an event? Could it with the right syntax? Why does the val() need to be appended to the end of the selector? I never would have thought of that. Is there a good reference to query syntax. I actually have a couple of ebooks, but they get all caught up in examples and don't really have very comprehensive references. I will try all of this out. Thanks, --Kenoli
  3. 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>
×
×
  • Create New...