Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to pass values from one div to another div in same page

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 5.51k
    Comment on it

    Hello reader! If you want to send the value from one div to another div in your same webpage, you can do this by help of JavaScript function.

    Lets do this with example-

    This is the div from which the value is taken

    <div id='td1'>This is the text that is going to pas with a click></div>
    <a href = "javascript:void(0)"  onclick = "show&#95;update('1')">Click Here</a>
    

    on below its make an anchor tag and call the function, as I call 'show_upadate'

    Now in the target div make an input box give it an id and from that id we set the source values

    <div><input type="text" name="name" id="showtd1" style="width:250px"> </div>
    

    Now finally at the bottom copy this code as script.

    <script >
    function show&#95;update(1)
    
    {    td1 = $('#td1'+i).html();   
        $("#showtd1").val(td1);  
    }
    </script>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: