Ver Mensaje Individual
  #4 (permalink)  
Antiguo 29/05/2014, 16:33
Avatar de wunderwaffen077
wunderwaffen077
 
Fecha de Ingreso: marzo-2014
Mensajes: 45
Antigüedad: 10 años, 1 mes
Puntos: 3
Respuesta: Llamar funciòn jQuery desde javascript

Un ejemplo de trigger usando jquery.
Al hacer click en el boton se disparara el evento click del elemento <a>,
podrias hacer algo parecido para tu caso.
Código HTML:
<html>
<head>
	<title></title>
	<script src="jquery-1.11.1.min.js"></script>
	<script type="text/javascript">
	
	$(function(){
		//$('#a1').trigger('click');
		$("body").on("click","#cmd_button",function(){	
			$("a").trigger("click");
			
		});
		
		$("body").on("click","a",function(){
			var href = $('a').attr('href');
	      		//window.location.href = href; //causes the browser to refresh and load the requested url
	      		window.open(href,'_blank','');
		});
	});

	

	</script>
</head>
<body>
	<input type="button"  id="cmd_button" value="Ir enlace"/>
	<a href="http://www.google.com.pe" id="a1" target="_blank">Ir</a>
</body>
</html>