0

I have one form on a page with no submit button:

 <form id='voteForm' action='xyz' method='post'>
 <fieldset>      
 <input type="hidden" id="task_id" value="{$feature_details['task_id']}" />
 <input type="hidden" id="vote_id" value="{$vote['vote_id']}" />
 <input type="hidden" id="vote_type" value="{$vote['vote_type']}" />
 <input type="hidden" id="vote_rating" value="{$vote['vote_rating']}" />
 <input id="btn-update-vote" class="btn btn-sm btn-primary" type='button' disabled="disabled" value="{L('SubmitVote')}">
 </fieldset>
 </form> 

I cannot get jQuery to trap a click event on the 'SubmitVote' button neither of these appear to work:

$('#btn_update_vote').click(function() { 
   console.log('Click: #btn_update_vote');
})  

$('form#voteForm').on('click', '#btn_update_vote', function() { 
   console.log('Click: #btn_add_comment');
})  

I do not understand what can cause this! Any help appreciated!

BTW: I CAN set the disabled attribute on the button using jQuery and on 'documentReady' I log the button to the console:

[Log] [ (tracker, line 446)
<input id=​"btn-update-vote" class=​"btn btn-sm btn-primary" type=​"button" disabled=​"disabled" value=​"Cast Your Vote">​
]

2 Answers 2

1

Your button attr disabled="disabled" make it unclickable, even inline onclick listen.

Sign up to request clarification or add additional context in comments.

Comments

0
<input id="btn-update-vote"

$('#btn_update_vote').click( //...

You declared your id with dashes (-), not underscores (_), so you need

$('#btn-update-vote').click(

Also @Richer is correct

2 Comments

good eyes! sorry for the disruption in the force due to bone-head over-sight! Thank-you
@SteveCronin I'm more of a star trek fan. Feel free to muddle the force whenever.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.