jquery - Trigger click of an element on the basis of a button using JavaScript code in HTML markup and/or attribute(s) -


i want trigger click on icon(image) specific class/id using onclick (or using other way) of button. please see image reference. clicking "1" should trigger "2". calling javascript function "launchtopwm" use following code trigger click:

$(".custom_toggle_menu_default").trigger("click");  

but wondering if can call code or perform fucntionality using click etc, href='javascript:$(".custom_toggle_menu_default").trigger("click");'

following code:

html 1:

 <img class="custom_toggle_menu_default" src="cc/tt/uu/images/launchtopwm.png"> 

html 2:

<a id="tsp" class="sp" href="launchtopwm()">cnw</a> 

give id element , show second anchor through pure javascript.

<!doctpe html>  <html>  <head>       <title> button style </title>       <style>         </style>  </head>  <body>      <a href="javascript:void(0)" onclick="getelementbyid('button').click()" > click me </a>  <button id="button">  buton </button>                  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>      <script>         $('#button').click(function(){             alert('buttons has been clicked');         });      </script>  </body>  </html>


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -