How to Split Value on Textbox using Javascript?
2014-11-13, 01:11 AM,
#1
Hello cpaelites..

This is the scenario, I have two textbox on my website html with id="textbox1" and id="textbox2"..
on first textbox.. visitor need to download my codes.. after they successfully download it they will paste it on 1st textbox.. and click Verify..

the code is example
Quote:xxxxxxx@this-is-a-sample

I want to split the xxxxxxx and put it on 2nd textbox after they click Verify.. and the @this-is-sample will remain on 1st textbox..

How it is possible?
I hope you can help me.. I've tried to google it but I can't find the answer.. Thanks in advance

How much you can take and keep moving forward.
That's how winning is done!

Reply
2015-02-01, 10:27 AM,
#2
I made working code for you! I hope this helps you in your project :)

Code:
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>TextBoxes</title>
    </head>
    <body>
        <input type="text" id="textbox1" placeholder="txt1"/>
        <input type="text" id="textbox2" placeholder="txt2"/>
        <button onclick="split();" type="button">Verify</button>
    </body>
    <script>
    function split() {
        var txtBox1 = document.getElementById('textbox1');
        var txtBox2 = document.getElementById('textbox2');
        var extraDelimiter = txtBox1.value.replace(/@/gi, ",@");
        var splittedValues = extraDelimiter.split(",");
        txtBox2.value = splittedValues[0];
        txtBox1.value = splittedValues[1];
    }
    </script>
</html>
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Is it possible to convert the landing page protection into javascript? ๖ۣۜPhoenix 5 246 2017-06-09, 11:54 AM
Last Post: tanfirislam
  How to split traffic [CPA] Sado 6 544 2017-03-22, 08:01 AM
Last Post: g3lux
  Please help with javascript and css mboitshepo 1 549 2016-06-25, 03:58 PM
Last Post: BrainyElite
  Javascript Unescape Not Working For me :( finnishhacker 0 296 2016-06-03, 04:04 AM
Last Post: finnishhacker
  How to split Desktop and Mobile Traffic? Legendary 3 547 2016-05-01, 07:51 PM
Last Post: Legendary





About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top