Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 48
  • Last Modified:

jQuery onChange HTML

I have an onChange function.  When a select changes I add a value to a specific div.  Can you pass atuall HTML along with that value?

$( "#result" ).html( premium );
Where premium is can I do something like:
$( "#result" ).html( .'CUSTOM HTML'. premium 'ADDITIONAL CUSTOM HTML.' );
0
rgranlund
Asked:
rgranlund
1 Solution
 
justaphaseCommented:
You can add an onchange event to your select tag id.

HTML:
<select id="selectid">
    <option value="1">One</option>
    <option value="2">Two</option>
</select>

Open in new window


JQuery:
$('#selectid').on('change', function() {
  $( "#result" ).html( 'CUSTOM HTML'+this.value+'ADDITIONAL CUSTOM HTML.' ); //this.value or $(this).val()
});

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now