`
Angi
  • 浏览: 9665 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

selected option's text

阅读更多
jQuery(function(){
	jQuery("#list").change(function(){
		alert(jQuery("#list option:selected").text());
	});
});


<select id='list'>
    <option value='1'>Option A</option>
    <option value='2'>Option B</option>
    <option value='3'>Option C</option>
</select>
分享到:
评论

相关推荐

    firefox下获取下列框选中option的text的代码

    alert("Selected option's text is : " + objText); var objValue = document.getElementById("mySelect").value; alert("Selected option's value is : " + objValue); } ``` 这个`chk`函数首先获取`&lt;select&gt;`...

    js添加select下默认的option的value和text的方法

    &lt;option value="mazda" selected="selected"&gt;Mazda&lt;/option&gt; &lt;option value="audi"&gt;Audi&lt;/option&gt; ``` 在上述代码中,通过给option元素指定value属性来设置其对应的值,而option元素的文本则直接在标签中写入,...

    jquery操作select option 的代码小结

    1、获取选中select的value和text,html代码如下: 代码如下: &lt;select id=”mySelect”&gt; &lt;option value=”1″&gt;one&lt;/... //获取选中记录的value值 $(“#mySelect option:selected”).text(); //获取选中记录的text值

    jquery获取select选中值的方法分析

    复制代码 代码如下:$(“#s option:selected”).text(); //获取选中的option的文本值 获取select中option的被选中的value值: $(#s).val(); $(#s option:selected).val(); js获取select选中的值: var

    javaScript

    - **添加**:`f.s.options[f.s.options.length] = new Option("追加的 text", "追加的 value");`在列表末尾添加新的选项。 - **修改**:`f.s.options[1] = new Option("更改的 text", "更改的 value");`或者直接...

    jquery根据一个值来选中select下的option实例代码

    接着,我们遍历 Select 下的所有 Option,通过 `$(this).text()` 获取当前 Option 的文本内容,与 `str` 进行比较。如果相等,我们就使用 `$(this).attr("selected", true)` 将该 Option 设置为选中状态。 在实际...

    pdf修改软件

    Able to convert the selected text object(s) into path(s), which will meet the pre-press requirement. For those computers which do not support or display certain embedded fonts, this new feature helps ...

    下拉菜单美化特效代码

    var selectedOptionText = $(this).find(':selected').text(); $selectedOption.text(selectedOptionText); }); // 显示/隐藏选项列表 $customSelect.click(function(e) { e.stopPropagation(); $options...

    struts2常用标签

    &lt;s:optiontransferselect doublelist="{'allUsers': ['Alice', 'Bob', 'Charlie'], 'selectedUsers': []}" doublename="selectedUsers" /&gt; ``` ##### 29. `&lt;s:param&gt;` —— 提供参数 - **功能**:为其他标签提供...

    端口查看工具

    o Added 'Include Selected Processes In Filters' option. Allows you to easily filter by selected processes. * Version 1.56: o Added new option: Ask before any action. (If you uncheck this option, ...

    HTML5考试题.pdf

    HTML5是现代网页开发的核心标准... &lt;option value="2" selected&gt;咸阳&lt;/option&gt; &lt;option value="3"&gt;延安&lt;/option&gt; ``` 这个例子中,"city"下拉列表有三个选项:西安对应值1,咸阳对应值2(默认选中),延安对应值3。

    Select精美下拉框(漂亮)

    var NewOption = document.createElement("OPTION"); SS_CreatedElements[SS_CreatedElements.length] = NewOption; this.options.add(NewOption, idx); NewOption.innerText = innerText; NewOption.value = ...

    javascript获取select标签选中的值

    复制代码 代码如下:var obj = document.getElementById(“testSelect”); //定位id var index = obj....复制代码 代码如下:$(‘#testSelect option:selected’).text();//选中的文本 $(‘#testSelect option:s

    OutlookAttachView v2.73

    filename in the 'Copy Selected Files To...' option, for example: %msgdate:yyyyMMdd% , %msgtime:HHmmss% * Version 1.67 o OutlookAttachView now displays (in the status bar) the current copied ...

    javascript的一些小功能,比较适合菜鸟学习!

    &lt;option value="s"&gt;ss&lt;/option&gt; &lt;option value="a"&gt;aa&lt;/option&gt; &lt;input type="radio" name="rd" value="0" onclick="selected(this);" /&gt; &lt;input type="radio" name="rd" value="1" onclick="selected(this);" /...

    HTML5考试题.docx

    &lt;option value="2" selected&gt;咸阳&lt;/option&gt; &lt;option value="3"&gt;延安&lt;/option&gt; ``` 这个下拉列表框提供了三个城市供用户选择,`selected`属性使得"咸阳"成为默认选中的项。当用户提交表单时,服务器将收到选定的...

    Django如何简单快速实现PUT、DELETE方法

    使用django的小伙伴们应该都... 's': $(#select-id).find(option:selected).text() }, success: function (data) { console.log('ok'); } }) def func(request): if request.method == 'GET': s = request.GET.g

    NGUI v3.5.1

    - FIX: NGUI will no longer intercept RMB events that occur outside the selected widget's area. - FIX: UICenterOnClick should now work as expected when there is no UICenterOnChild present. - FIX: ...

    编辑任意PDF文件

    3. Fixed a crash issue when ESC/Enter or close the tool box is selected after dragging it out from toolbar. 4. Fixed a possible crash issue while performing a text using Search Toolbar. 5. Fixed the ...

    JavaScript实现选择文件夹

    这里,字符串`s`被分割成多个驱动器信息项,然后为每一个驱动器创建一个新的`OPTION`元素,并设置其`value`和`text`属性。这些选项随后被添加到下拉列表中,供用户选择。 #### 4. 获取选定驱动器下的文件夹列表 当...

Global site tag (gtag.js) - Google Analytics