无法通过jQuery的选择格子元素 [英] Cannot select grid element through jQuery
问题描述
这是一个后续问题<一href=\"http://stackoverflow.com/questions/1591081/asp-net-how-to-pass-container-value-as-javascript-argument\">ASP.NET如何通过容器值作为JavaScript参数
达林季米特洛夫慷慨提供<一个href=\"http://stackoverflow.com/questions/1591081/asp-net-how-to-pass-container-value-as-javascript-argument/1591160#1591160\">his回答使用 jQuery的,
但由于某些原因,我无法的选择的网格行的,我想。
Darin Dimitrov has kindly provided his answer using jQuery,
But for some reason, I was not able to select the grid row I wanted to.
下面是jQuery的用于选择行。
Here is the jQuery used to select row.
$(function() {
$('#_TrustGrid input[name^=trustDocIDTextBox]').each(function(index) {
$(this).click(function() {
alert('Hello world = ' + index);
setGridInEditMode(index);
});
});
});
下面是实际的输出HTML标记。
Here is the actual output HTML markup.
<input
id="_TrustGrid_ctl16_ctl05_ctl00_trustDocIDTextBox"
type="text" value="198327493"
name="_TrustGrid$ctl16$ctl05$ctl00$trustDocIDTextBox"/>
我刚开始使用jQuery今晚在走
官方 jquery选择文档但并不成功。
我失去了一些东西在这里?
推荐答案
我不知道为什么通过 #_ TrustGrid
选择是行不通的。
我能够通过指定获得解决该问题:输入
,如下图所示。
I do not know why selecting through #_TrustGrid
would not work.
I was able to get around the problem by specifying :input
as shown below.
$(function() {
//$('#_TrustGrid input[id$=trustDocIDTextBox]').each(function(index) {
$(':input[id$=trustDocIDTextBox]').each(function(index) {
$(this).click(function() {
alert('Hello world = ' + index);
setGridInEditMode(index);
});
});
});
这篇关于无法通过jQuery的选择格子元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!