0

In the below code I am binding the change event to a HTML select and then trying to set its selected value. However, my change event is not called when I select the value of the HTML select via jQuery with the following code:

row.find(".js-sAttribute").change(function ()
{
    alert('1');
});

//**the following should trigger change event binded in the above code**
row.find(".js-sAttribute").each(function() { this.selected = (this.text == sAttEnum.ProductID); });

Please advise.

1
  • I see conflicting code. Can you clean up your question a bit to be more clear? Commented Apr 26, 2011 at 6:10

1 Answer 1

1

I believe what you need to do is call change() with no arguments after you change the selection manually. Otherwise, it won't actually trigger the change event...

row.find(".js-sAttribute").each(function() { 
   this.selected = (this.text == sAttEnum.ProductID);
   $(this).change(); 
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.