Osmany González Osmany González - 1 year ago 153
Javascript Question

OnClick on button with title

I need when click in a button with title = "Like" redirect to other page in javascript.

<button class="button-like button button-medium button-responsive" aria-describedby="tooltip-94" tabindex="0" title="Like">Like</button>

Answer Source

Make use of $('button[title="Like"]') selector and call onclick on it.


  $('button[title="Like"]').on('click', function(){
    window.location.href = 'https://www.google.com'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download