CalZone
CalZone

Reputation: 1721

twitter bootstrap button action + opening a modal

I'm using twitter bootstrap for a form.

A button needs to validate the form and then present a modal. I realized that the button doesn't validates the form if I just point it to toggle the modal.

<button id="button3" data-toggle="modal" data-target="#paymentDisclaimerModal">button 3</button>

I decided to show modal using javascript.

<button id="button3" onclick="$(#paymentDisclaimerModal).modal('show');" data-toggle="modal" data-target="#paymentDisclaimerModal">button 3</button>

Not working! Am I supposed to user a separate javascript block? Help much appreciated.

Upvotes: 0

Views: 78

Answers (1)

Cirou
Cirou

Reputation: 1430

Your javascript code seems to be wrong:

<button id="button3" onclick="$(#paymentDisclaimerModal).modal('show');" data-toggle="modal" data-target="#paymentDisclaimerModal">button 3</button>

The jQuery selector must be a valid string, change it to:

<button id="button3" onclick="$('#paymentDisclaimerModal').modal('show');" data-toggle="modal" data-target="#paymentDisclaimerModal">button 3</button>

Upvotes: 1

Related Questions