HTML button opening link in new tab

前端 未结 8 1299
挽巷
挽巷 2020-12-05 17:32

So this is the simple code for the button to open a certain link

                
8条回答
  •  感情败类
    2020-12-05 17:42

    Try using below code:

    
    

    Here, the window.open with _blank as second argument of window.open function will open the link in new tab.

    And by the use of return false we can remove/cancel the default behavior of the button like submit.

    For more detail and live example, click here

提交回复
热议问题