We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

jquery on button click

Hi. I have a problem, when i am trying to create jquery on click function for my Tag::SubmitButton. I want to show simple alert message when user click on a button. Here is my view code:

use Phalcon\Tag;
echo Phalcon\Tag::javascriptInclude("https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false);
echo Phalcon\Tag::javascriptInclude("javascript/jquery.js");

<script type="text/javascript">

    //atr = $(".klasa").attr("id");
    //alert("Id je: " + atr);

        alert("Some message");


<h2>Basic example</h2>

<?php echo Tag::form("xml/pretraga"); ?>

<label for="name">Title</label>
<?php $opt = array('title', 'id'=>'nesto', 'size'=>'10');
  $buttopt = array('Show', 'id'=>'dubmic','class'=>'klasa');
<?php echo Tag::textField($opt) ?>
<?php echo Tag::SubmitButton($buttopt) ?>


I need answer as soon as possible.


Tag::SubmitButton isn't generating the id="dubmic" ?

Your Javascript is "dugmic" and your button id is "dubmic". Also, your click binding is not in a document.ready.