[英]If span display set to inline do this
I'm working on a .net website that validates an input and if it fails adds an inline style "display:inline;" 我正在开发一个验证输入的.net网站,如果失败则添加内联样式“display:inline;”
Im trying to use jQuery to see this style and add a class to the respective input field. 我试图使用jQuery来查看此样式并将类添加到相应的输入字段。
if(!!$('span.errorp').length ){
alert('hi');
}
the above is what im currently using to ensure i can target the correct tag which works, 以上是我目前正在使用的,以确保我可以定位正常的标签工作,
I guess i need something similar too... 我想我也需要类似的东西......
if(!!$('span.errorp').display:inline ){
alert('hi');
}
Try the following 请尝试以下方法
if ($('span.errorp').css('display') === 'inline') {
...
}
You can use something like: 您可以使用以下内容:
$('span.errorp').css('display', 'inline');
It's not necessary to check for length. 没有必要检查长度。 If there are no matches, nothing happens.
如果没有匹配,则没有任何反应。
if($('span.errorp[style=display:inline]')) {
// do stuff
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.