String attribute values in multiple lines, HTML

前端 未结 6 800
清歌不尽
清歌不尽 2020-12-03 17:24

Is it possible, in HTML to write something like:

....

The idea is spl

6条回答
  •  渐次进展
    2020-12-03 18:03

    You can use @laaposto suggestion as long as there's no space between lines.

    If you don't want to follow that rule, then you need to use javascript to remove the spaces:

    var anchor = document.getElementsByTagName("a");
    
    for(var i=0; i<= anchor.length; i++) {
        var href = anchor[i].href.replace(/%20/g,'');
        anchor[i].href = href;     
    }
    

    Fiddle Demo

    or easier with jQuery:

    var href = $('a').attr('href').replace(/ /g,'');
    $('a').attr('href', href);
    

    Fiddle Demo

提交回复
热议问题