Show hide button jQuery Mobile

by katalin_2003

HTML

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<input type="button" id="hide_btn" value="Hide Submit Button" data-inline="true"/>

<input type="submit" id="submit_btn" value="Submit" data-theme="a" data-inline="true"/>

JavaScript

$('#submit_btn').button();

$('#hide_btn').toggle(function(){
    $(this).prev('span').find('span.ui-btn-text').text("Show Submit Button");//Change the text of the button
    $('#submit_btn').closest('.ui-btn').hide();
},
function(){
    $(this).prev('span').find('span.ui-btn-text').text("Hide Submit Button"); //Change the text of the button
    $('#submit_btn').closest('.ui-btn').show();
});