Solved

jQuery onChange HTML

Posted on 2015-02-24
1
40 Views
Last Modified: 2015-03-07
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
Comment
Question by:rgranlund
1 Comment
 
LVL 1

Accepted Solution

by:
justaphase earned 500 total points
ID: 40628856
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question