jQuery: Adding two attributes via the .attr(); method

前端 未结 6 2044
庸人自扰
庸人自扰 2020-12-07 12:35

EDIT:

I learned that using other value than _blank, DOES NOT work on mobile browsers to open new windows/tabs.

For example, if

6条回答
  •  执笔经年
    2020-12-07 13:41

    Use curly brackets and put all the attributes you want to add inside

    Example:

    $('#objId').attr({
        target: 'nw',
        title: 'Opens in a new window'
    });
    

提交回复
热议问题