[已解决]如何在更改HTML选择时显示特定文本? [英] [Solved] How to display the specific Text on change of HTML Select?

查看:105
本文介绍了[已解决]如何在更改HTML选择时显示特定文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我的网页表格中有一个HTML Select(下拉)控件,其中包含以下选项:



Hi All,

I have an HTML Select(Dropdown) control in my web form with the following options:

<select class="body_text" name="critical">
   <option value="Select"> Select </option>
   <option value="LOW"> Low </option>
   <option value="NORMAL"> Normal </option>
   <option value="HIGH"> High </option>
   <option value="CRITICAL"> Critical </option>      
</select>





在ASP Server控件中,它更容易处理下拉列表选择改变事件。

就像我想在foll上显示DIV中的文本一样由于场景使用HTML Select Control并且不能在控件中使用runat =server:



如果Selection为LOW,则DIV应显示:



As in ASP Server control its much easier to handle dropdownlist selection change events.
Just like that I want to Display the text in a DIV on the following Scenario using HTML Select Control and cannot use runat="server" in the control:

If the Selection is LOW the DIV should display:

"Priority Low: The selection is Low"





如果选择为正常,则DIV应显示:



If the Selection is NORMAL the DIV should display:

"Priority Normal:The selection is Normal"





如果选择为高,则DIV应显示:



If the Selection is HIGH the DIV should display:

"Priority High: The selection is High"





如果选择是关键的,那么DIV应该是显示:



If the Selection is CRITICAL the DIV should display:

"Priority Critical: The selection is Critical"







我该如何应用这个sce nario使用JavaScript。请帮忙。



谢谢,

AR。




How can I apply this scenario using JavaScript. Please Help.

Thanks,
AR.

推荐答案

随着Jquery选择器的帮助你可以实现这个目标: -



With the help of Jquery selector you can achieve this:-

<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" language="javascript">


function (){


' 。body_text')。change( function (){
var a =
('.body_text').change(function(){ var a =


这篇关于[已解决]如何在更改HTML选择时显示特定文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆