Shehzad009
Shehzad009

Reputation: 1607

Creating html button link - not working

very quick question. I have a href link like so in my template.

<a href={% url tiptop.views.client_items name.pk %}>add item</a>

This works But if I wanted it to create it as a button for some reason it does not work.

<input type="button" on_click="window.location.href='{% url tiptop.views.client_items name.pk %}></a>'" value="Add item">

I don't understand why it does not work. Basically, the button shows, but when I click on the button it does NOTHING.

Upvotes: 0

Views: 3427

Answers (1)

anthares
anthares

Reputation: 11223

Try:

   <a <!--...your link code here -->
   <input type="button" onClick="window.location.href='{% url tiptop.views.client_items name.pk %}'" value="Add item"/></a>

Your Quotes the single and the double one where not closed properly.

Upvotes: 5

Related Questions