Reputation: 13
I need to change text into a span.
I'm looking for this because I have a drop-down menu, I use a jQuery selector option but this does not change the text, select only from the options.
I need to change "seleziona" with other text.
Upvotes: 0
Views: 82
Reputation: 8868
The answer posted by Srebnywilkun is correct. This answer only provides a short notation.
$("#span1").on('change',function(){
$("#span2").text('calculated value');
}).change(); // defining this at the end of the function would automatically trigger the change event after the event is registered.
Upvotes: 0
Reputation: 7
1.
$("#span1").on('change',function(){
//Do calculation and change value of other span here
$("#span2").text('calculated value');});
2.
$("#span1").text('test').trigger('change');
Upvotes: 1