Sorry, I dunno why I wrote that, it's correct in my code:
asp Code:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ButtonUserControl.ascx.vb" Inherits="F1TimeTrials.ButtonUserControl" %>
<script type="text/javascript">
function buttonClicked(sender) {
var label = $(sender).parent().parent().find('span:eq(0)');
alert('jup');
label[0].innerHTML += '|';
return false;
}
</script>
<asp:Table runat="server">
<asp:TableRow runat="server">
<asp:TableCell runat="server"><asp:Button runat="server" ID="button" Text="Click!" OnClientClick="return buttonClicked(this);" /></asp:TableCell>
<asp:TableCell runat="server"><asp:Label runat="server" ID="label" Text="" /></asp:TableCell>
</asp:TableRow>
</asp:Table>
Still nothing. No alerts, no post-backs, no | characters.
I tried debugging with Firebug but unless I'm doing it wrong even that isn't working. I just go to the sripts tab, find the piece of javascript, put a breakpoint beside it, but it doesn't hit when I click the buttons.
It does hit suddenly when I refresh the page. Then I also get the option like Run, Step Into, Step Over, etc, but whatever I do (step into, over, out) it just seems to skip the entire code in the function. The breakpoint is on the function declaration ("function buttonClicked(sender)").
EDIT
And when I put an alert on the very first line of the function it does show, so the function is getting called OK.
EDIT2
When I try this javascript, only 'hit' is shown:
javascript Code:
<script type="text/javascript">
function buttonClicked(sender) {
alert('hit');
alert($(sender));
var label = $(sender).parent().parent().find('span:eq(0)');
alert('jup');
label[0].innerHTML += '|';
return false;
}
</script>
EDIT3
When I alert just 'sender' it shows me something like object HTMLElement so it's not null.