<!DOCTYPE html> <html> <head> <title>Try jQuery Online</title> <style> a { cursor: pointer; } </style> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> function empty(v) { switch (v) { case '': case 0: case '0': case null: case false: case 'undefined': return true; default: return false; } } function copy_vals() { if( empty($('#a_start').html()) || empty($('#a_end').html()) ) { alert('Empty!'); return; } alert($('#a_start').html() + " - " + $('#a_end').html()); $('#ip_start').val($('#a_start').html()); $('#ip_end').val($('#a_end').html()); } </script> </head> <body> <input type="text" value="1.1.1.1" id="ip_start" /><br /> <input type="text" value="1.1.1.1" id="ip_end" /> <br /><br /> <span type="text" id="a_stat">1.1.1.0</span><br /> <span type="text" id="a_end">1.1.1.255</span> <br /><br /> <a onclick="javascript: copy_vals();">Copy</a> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more