javascript - Simple way to toggle a button's value -


like title says i'd user click button , new value. in case button toggle menu hidden visible , , forth. here code.

i want "show menu" , "hide menu"

right click, menu opens , new value set , menu can close value doesn't go back.

jquery:

$(function () {    $("#uicontainer").hide();  $("#button").click(function() { $("#uicontainer").toggle( function() {     $("#button").val('hide menu'); });   }); });  

$(function () {        $("#uicontainer").hide();      $("#button").on('click', function() {         $("#uicontainer").toggle();         this.value = this.value == 'hide menu' ? 'show menu' : 'hide menu';     }); });  

fiddle


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -