开发者

How to Append Value and Text to Picklist on Crm 4.0 using js or jquery?

开发者 https://www.devze.com 2023-04-05 01:26 出处:网络
i have a picklist its name is new_tarif开发者_运维百科f and i want to add values to picklist onload using js or jquery.How can i do it ?document.onLoad(function(){

i have a picklist its name is new_tarif开发者_运维百科f and i want to add values to picklist onload using js or jquery.How can i do it ?


document.onLoad(function(){
$(#new_tariff).append(" VALUES TO BE APPENDED ");
});

This assumes new_tariff is set to id="new_tariff". Replace the # with a . if you're using a class. These are much simpler than a name: $.prop("name", "new_tariff") (http://api.jquery.com/prop/).

FYI there is $.prepend() which does almost exactly the same thing as append, except it adds it to the beginning instead of the end.

It would probably be better to have some default value(s) that you replace onLoad in case the onLoad fails. To do this you would use $.html() to replace the default values with the ones from onLoad. (you can also store the values externally and do an $.ajax() call to $.load() them in, but this is more complicated.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号