I have an anchor and a text box as below:
 <div id="container">
        <input type="text" id="textBox" />       
        <a id="anchorTest" href="javascript: alert('inside anchorTest')">Click me</a>
    </div>
I'm trying to make the default button to the anchor when the enter key is clicked:
$(document).ready(function () {
            $('#anchorTest').click(function () {
                alert('clicked');
            });
            $('#container').keyup(function (e) {
                if (e.keyCode == 13) {                    
                    $('#anchorTest').triggerHandler('click');
                }
            });
        });
But the anchor href javascript is never called?
How to click the anchor using JQuery so that the href is also called?
I used the below code and it worked but is there any better way as it submits the form whereas I'd like to have a pure javascript code:
window.location = $('#anchorTest').attr('href');   
Thanks
 
     
     
     
    