Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to assign the drop-down box by js,jQuery and easyui

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "js,jQuery and easyui how to achieve the specified assignment of the drop-down box", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "js,jQuery and easyui how to achieve the specified assignment of the drop-down box"!

Js implementation:

1. By letting the I option select the I for the selected implementation, the code is as follows: (id is the drop-down box id)

(1) document.getElementById ("id") .options.selected = true

(2) document.getElementById ("messagetoid") .selectedIndex = 1; (select the first option)

two。 This is achieved by judging the value of option. The code is as follows:

Document.getElementById ("messagetoid") .value= ""; (check option with empty value)

JQuery implementation:

1. By selecting the I option, which is similar to the 1 implemented by js, the code is as follows:

$("# id") .get (0) .selectedIndex =

1; (select the first option)

two。 There are two ways to do this by judging the value of option. The code is as follows:

(1) $("# id") .val ("123"); (select option with a value of" 123")

(2) $("# messagetoid") .attr ("value", ""); (select option with empty value)

EasyUI implementation:

$('# id'). Combobox ('setValue','A'); (select option with a value of A)

At this point, I believe that everyone on the "js,jQuery and easyui how to achieve the specified assignment of the drop-down box" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report