Results 1 to 2 of 2

Thread: Run JS function on click

  1. #1
    Join Date
    Jul 2013

    Run JS function on click

    I've adapted a piece of code which copies fields over when a checkbox is checked. However I need this to work when a 'submit' button is clicked. I've added an event handler which runs the function once the button has been pressed. However it is not working, I'm not sure what's happening here. Here's my Fiddle http://jsfiddle.net/sui_page/z4wAr/

  2. #2
    Join Date
    May 2006
    Somewhere behind your screen
    <!DOCTYPE html>
    <html lang="en">
    <meta charset="utf-8" />
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script type="text/javascript">
    var done=false;
    return false;
    var bindGroups = function () {
        // First copy values
        // Then bind fields
        $("input[name='a1']").keyup(function () {
        $("input[name='a2']").keyup(function () {
        $("input[name='a3']").keyup(function () {
    var unbindGroups = function () {
    <form name="details">
        <input type="text" name="a1" />
        <br />
        <input type="text" name="a2" />
        <br />
        <input type="text" name="a3" />
        <br />
        <input id="create-card" type="submit" name="creat-card" value="enter" />
    <form name="details-copy">
        <input type="text" name="b1" />
        <br />
        <input type="text" name="b2" />
        <br />
        <input type="text" name="b3" />

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles