Preethi Jha Preethi Jha - 1 year ago 62
jQuery Question

JQuery after using $.publish to load a select,want to select particular option in struts 2 select tag

I am using

to populate the dropdown (Struts 2 select tag) after that, I want the dropdown to be auto-selected to a value.

I tried the following:

//$('#selectedAttribute option[value="attributeId"]');

None worked.

Answer Source

No, after using $.publish() you can't auto select the drop down. The code to auto select dropdown should be inside the $.subscribe(). Some another event you should publish when loading is complete.

  $.subscribe('loadCompleteAttributeList', function(event, data) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download