Ari Jashari
Ari Jashari

Reputation: 11

javascript on click does not work

<script type="text/javascript">
    $(document).ready(function () {
        $("#HyperLink12").click(function () {
            $('#webpage_datalist_product_full').animate({ left: "+=285" }, 400);
        });
    });
</script>

                            <asp:HyperLink ID="HyperLink12" runat="server" 
                                ImageUrl="slide_arrow_right_click.png">HyperLink</asp:HyperLink>

                        </div>

on click the javascript does nothing ,i added my html code

Upvotes: 0

Views: 47

Answers (1)

jonny
jonny

Reputation: 3098

If all you're trying to achieve when clicking the hyperlink is the animation you show above, I recommend preventing the default action usually executed by clicking hyperlinks, which is navigating to the URL value stored in its href attribute. So, for a start, change your code to this:

<script type="text/javascript">
    $(document).ready(function () {
        $("#HyperLink12").click(function (event) {
            event.preventDefault(); //Prevents the default hyperlink click action
            $('#webpage_datalist_product_full').animate({ left: "+=285" }, 400);
        });
    });
</script>

If this doesn't work and you need more help, feel free to comment; I will update my answer.

Upvotes: 1

Related Questions