Solved

jQuery onChange HTML

Posted on 2015-02-24
1
39 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

919 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now