Re: [Express-js] Beginner help button or link to next page

791 views
Skip to first unread message

Duncan Gmail

unread,
Dec 18, 2012, 11:48:20 AM12/18/12
to expre...@googlegroups.com
Why not just use an anchor tag...
a(href='/uploads')

On 15 Dec 2012, at 19:21, David Aspegren <david.a...@gmail.com> wrote:

Hi everyone,

I have a quick question about how to navigate pages in express and jade.
I have created an app.js file which works fine, it shows the index view. I have also created another view called upload.
The localhost:3000/upload page works fine separately.
No I want to know how to put a button in the index view to go to the upload view.

should i do something like

button(onclick="./upload") or is there a different way which is preferable, I just want to switch pages from within the jade view.

regards,
David

--
You received this message because you are subscribed to the Google Groups "Express" group.
To view this discussion on the web visit https://groups.google.com/d/msg/express-js/-/76A-ixrDL54J.
To post to this group, send email to expre...@googlegroups.com.
To unsubscribe from this group, send email to express-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/express-js?hl=en.

Ryan Schmidt

unread,
Dec 18, 2012, 2:49:42 PM12/18/12
to expre...@googlegroups.com

On Dec 15, 2012, at 13:21, David Aspegren wrote:

> I have created an app.js file which works fine, it shows the index view. I have also created another view called upload.
> The localhost:3000/upload page works fine separately.
> No I want to know how to put a button in the index view to go to the upload view.
>
> should i do something like
>
> button(onclick="./upload") or is there a different way which is preferable, I just want to switch pages from within the jade view.

The "onclick" attribute is for setting JavaScript code to be executed when the element is clicked, so this won't work, since "./upload" is not valid JavaScript.

https://developer.mozilla.org/en-US/docs/DOM/element.onclick

Use normal "a" tags with "href" attributes. That's how you link web pages together.

a(href="./upload") Go to the upload page

If you want the link to look like a button, then style it that way with CSS. For example if you were using the Twitter Bootstrap CSS framework, you would add the "btn" class.

a.btn(href="./upload") Go to the upload page

http://twitter.github.com/bootstrap/base-css.html#buttons


Reply all
Reply to author
Forward
0 new messages