javascript - How can I put click event inside a click event jquery? -
if user click first button, second button show up, , if user click second button, action called. how can achieve this? appreciate.
$('first_click').on('click',function(){ //second_click button show , action here $('second_click').on('click',function(){ alert('ok'); }); });
try this:
'use strict' $(function() { var $button1 = $('#button1'); var $button2 = $('#button2'); $button2.hide(); $button1.on('click', function() { $button1.hide(); $button2.show(); }); $button2.on('click', function() { // action... }); })();
Comments
Post a Comment