如何获得以单词开头的span id [英] How to get the span id which starts with a word

查看:114
本文介绍了如何获得以单词开头的span id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我有两个跨度,例如 date_eform time_eform

actually i have two span with ids like this date_eform and time_eform.

现在我必须得到这些ID并检查 span id是否以 date _ 那么我必须执行一些逻辑。如果 span id开始于时间_ 那么另一个动作。

Now i have to get these ids.. and check if the span id starts with date_ then i have to perform some logic. and if span id starts with time_ then another action.

 <span id='date_eform'></span><span id='time_eform'></span>

请帮助我。

Please help me in this.

推荐答案

您需要从选择器开始

so

$.each('span[id^="date_"]',function(){
   //your code here
});

$.each('span[id^="time_"]',function(){
   //your code here
});

这篇关于如何获得以单词开头的span id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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