MrCycling
MrCycling

Reputation: 3004

JQuery get select value the change page text to that value

I have been pounding the head in the sand on what should be an easy project.

I have a select in a form that lists products and once a visitor picks the product from the select dropdown I want to change the text in some subsequent questions from "What is wrong with your product" to "What is wrong with your product-name-you-selected"

I have seen plenty of examples for obtaining the value of the select form and for replacing text, but darned if I can get them to work together. Makes me feel like such a noob.

Any suggestions? Thanks

Upvotes: 0

Views: 66

Answers (1)

Severe Torture
Severe Torture

Reputation: 319

I am coding this right now is this your problem? http://jsfiddle.net/b597j/

$( "#combo" ).change(function() {
  var value2 = $('#combo').val();
  var nationality = $('select[name="combo_name"]').val();

  $( "#test" ).append( value2 );
  $( "#test2" ).append( nationality );
});

Of course with append I still add every change you can rewrite it as delete content and after that add (with append) selected content from selectbox. Sorry for my english.

Upvotes: 1

Related Questions