How to Get Element By Class in JavaScript?

前端 未结 11 2581
南旧
南旧 2020-11-22 01:48

I want to replace the contents within a html element so I\'m using the following function for that:

function ReplaceContentInContainer(id,content) {
   var c         


        
11条回答
  •  忘掉有多难
    2020-11-22 02:26

    When some elements lack ID, I use jQuery like this:

    $(document).ready(function()
    {
        $('.myclass').attr('id', 'myid');
    });
    

    This might be a strange solution, but maybe someone find it useful.

提交回复
热议问题