This is a migrated thread and some comments may be shown as answers.

Button click causes page navigation (or back navigation?)

1 Answer 118 Views
HTML5, CSS, JavaScript
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jan-Dirk
Top achievements
Rank 1
Jan-Dirk asked on 22 Aug 2013, 02:59 PM
I am working on a new app (with Kendo UI framework) that currently has 2 views:
- Home view with a listview and a + button to add items. This view is selectable from the tabstrip
- An add item view that is not selectable from the tabstrip. You can navigate to this view with the + button on the home view

On the 'add item' view I have a camera-button (a href with data-role button) that currently shows a picture. When the button is clicked it loads a picture into a div. However, before it actually does that it moves me back to the Home-view.

This is how I have configured the button
<a href="" data-role="button" data-icon="camera" id="takePicture"></a>

And this is how the click event of the button is handled:
$('#takePicture').click(function(e) {
            $('.picture').attr("src", "./styles/images/logo.png");
            $('.picture').html()
            return false;
});

Any reason why a click would cause to move away from the current view?

1 Answer, 1 is accepted

Sort by
0
Accepted
Jan-Dirk
Top achievements
Rank 1
answered on 23 Aug 2013, 07:56 AM
I found the solution. Removing the href="" from the button declaration solved this.
Tags
HTML5, CSS, JavaScript
Asked by
Jan-Dirk
Top achievements
Rank 1
Answers by
Jan-Dirk
Top achievements
Rank 1
Share this question
or