Tuesday, 15 July 2014

jquery - Disable submit button in JavaScript until user share the facebook page. -



jquery - Disable submit button in JavaScript until user share the facebook page. -

my question is:

how disable submit button in javascript until user share facebook page.

i using radio buttion show/hide facebook share button.

---------javascript show/hide div----------------

<script type="text/javascript"> $(document).ready(function(){ $('input[type="radio"]').click(function(){ if($(this).attr("value")=="low"){ $(".box").hide(); $(".low").show(); } if($(this).attr("value")=="high"){ $(".box").hide(); $(".high").show(); } }); }); </script>

---------css----------------

.box{ padding: 5px; display: none; margin-top: 20px; border: 1px solid #000; width:80%; }

------------html---------------

<label><input type="radio" name="priority" value="low" id="priority_0" />low</label> <label><input type="radio" name="priority" value="high" id="priority_0" />high</label> <input type="submit" name="button" id="adbtn" value="" /> <div class="low"></div> <div class="high box">here facebook page link share </div>

i want when user click on high radio button submit button should disabled. user share page on facebook after sharing page submit button enabled.

thanks in advance.

<script type="text/javascript"> $(document).ready(function(){ $('input[type="radio"]').on('change', function(){ if($(this).val()=="low"){ $(".box").hide(); $(".low").show(); $('input[type="submit"]').removeattr('disabled'); } else if($(this).val()=="high"){ $(".box").hide(); $(".high").show(); $('input[type="submit"]').attr('disabled','disabled'); } }); }); </script>

use 'change' instead of 'click' event.

javascript jquery facebook

No comments:

Post a Comment