jquery change div text

后端 未结 3 1864
太阳男子
太阳男子 2020-12-03 03:59
\'
\\n\\
相关标签:
3条回答
  • 2020-12-03 04:55

    best and simple way is to put title inside a span and replace then.

    '<div id="'+div_id+'" class="widget" style="height:60px;width:110px">\n\
            <div class="widget-head ui-widget-header" 
                    style="cursor:move;height:20px;width:130px">'+
         '<span id="'+span_id+'" style="float:right; cursor:pointer" 
                class="dialog_link ui-icon ui-icon-newwin ui-icon-pencil"></span>' +
          '<span id="spTitle">'+
          dialog_title+ '</span>'
     '</div></div>
    

    now you can simply use this:

    $('#'+div_id+' .widget-head sp#spTitle').text("new dialog title");
    
    0 讨论(0)
  • 2020-12-03 04:56

    I think this will do:

    $('#'+div_id+' .widget-head > span').text("new dialog title");
    
    0 讨论(0)
  • 2020-12-03 05:05

    Put the title in its own span.

    <span id="dialog_title_span">'+dialog_title+'</span>
    
    $('#dialog_title_span').text("new dialog title");
    
    0 讨论(0)
提交回复
热议问题