0

The call to start() should trigger the change

http://jsfiddle.net/txqed/2/

$(function () {
    $('#ddlTo').on("change", function () {
        $("#div1").html($(this).val());
    })

    start();
});

function start() {
    $('#ddlTo').val("master");
}
mplungjan
  • 169,008
  • 28
  • 173
  • 236
Morteza570
  • 17
  • 1

2 Answers2

2

Your question isn't entirely clear, but my guess is you'd like to fire the change event when you initialise the value of the select.

This should do what you expect:

$('#ddlTo').val("master").change();

The change event only fires when the user initiates the change.

Community
  • 1
  • 1
alnorth29
  • 3,525
  • 2
  • 34
  • 50
-1

As alnorth29 pointed out, your question is not clear but maybe this is what you want:

http://jsfiddle.net/txqed/3/

$('#ddlTo').on("change", function() {
    $("#div1").html($(this).val());
    start();
});

Basically changing the select box back to "master" after displaying user selected value.

Edit: I misunderstood your question. As pointed out in the comments this behavior is not very logical.

mtariq
  • 400
  • 1
  • 10