Welcome Guest, Not a member yet? Register   Sign In
How to change the text on a button progamatically?
#6

(This post was last modified: 01-09-2018, 06:56 AM by richb201.)

(01-08-2018, 11:25 PM)XtreemDeveloper Wrote: You can use this code for change text on a button.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
    $("button").click(function(){
        $(".content").text("Test");
    });
});
</script>
<h2 class="content">This is a heading</h2>
<button>Click me to hide paragraphs</button>

Thanks Xtreem. I guess the code you posted does what I need but works by a user clicking the button itself. I'm using grocery crud where I created buttons for each record in my list. When a user clicks the button I jump to a function in the controller that either needs to change the text on a danger button, or initiate a jquery function (in the view) to change the text on a danger button. The user never clicks that danger button themselves. It is just informational.
proof that an old dog can learn new tricks
Reply


Messages In This Thread
RE: How to change the text on a button progamatically? - by richb201 - 01-09-2018, 06:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB