I have this code:
<a href="#" class="button" id="buyme" ></a>
<a href="#" id="buy" onclick="placeOrder('10');return false;"><span id="please">click me</span></a>
<script>
$('#buyme').click(function() {
$('#buy').trigger(function(placeOrder('10')));
});
</script>
<script>
function placeOrder(var) {
.....
}
</script>
What I want to do is when I click on #buyme to trigger the onclick from the #buy link or to trigger the function from inside onClick.
My example doesn’t seem to do it. Any ideas?
edit:
for some reason :
$('#buyme').click(function() {
$("#buy").click();
});
doesn’t work
Just call the function yourself:
You could also trigger the click event of the button and let it call the function (seems a bit backwards though):