Find all elements whose id begins with a common string

前端 未结 5 730
臣服心动
臣服心动 2020-12-01 09:01

I have a XSL that created multiple elements with the id of \"createdOn\" plus a $unique-id

Example : createdOnid0xfff5db30

I want to find a

5条回答
  •  甜味超标
    2020-12-01 09:25

    Because you didn't tag jQuery, and you probably don't need it, my suggestion would be to add a class to these elements when you create them. Then use the getElementsByClassName() function that's built into most browsers. For IE you would need to add something like this:

    if (typeof document.getElementsByClassName!='function') {
        document.getElementsByClassName = function() {
            var elms = document.getElementsByTagName('*');
            var ei = new Array();
            for (i=0;i

提交回复
热议问题