Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <title>Not Working.php</title>
- <link rel="stylesheet" href="jquery-ui-1.10.4.custom/css/ui-lightness/jquery-ui-1.10.4.custom.css">
- <script src="jquery-ui-1.10.4.custom/js/jquery-1.10.2.js"></script>
- <script src="jquery-ui-1.10.4.custom/js/jquery-ui-1.10.4.custom.js"></script>
- </head>
- <body>
- <script>
- function romanize (num) {
- return "(" + "roman for " + ")";
- }
- $(document).ready(function(){
- $(".romanCheck").live("change",function() {
- alert("#romanCheck.click has been hit");
- var romanValue = "";
- var roman = $("#romanCheck").is(':checked');
- if ( roman ) {
- var itValue = $(this).val();
- romanValue="(" + romanize(itValue) +")";
- }
- $("#romanDisplay").text(romanValue);
- });
- $("span.iterationField input").live("change",function() {
- alert("#iteration.change has been hit");
- var romanValue = "";
- var roman = $("#romanCheck").is(':checked');
- if ( roman ) {
- var itValue = $(this).val();
- romanValue="(" + romanize(itValue) +")";
- }
- $("#romanDisplay").text(romanValue);
- });
- });
- </script>
- <form action='EventValidateProcess.php' method='post'>
- <?php
- $doesShow = 1;
- $isRoman = 1;
- $iteration - 13;
- print "<table>n";
- print "<tr>nt<td>Iteration</td>nt";
- print "<td><span id='iterationField'><input type='text' name='iteration' value='" . $iteration . "'></span></td>nt";
- print "<td><input type='checkbox' name='doesShow' value='1'";
- if ($doesShow == 1) {
- print " checked";
- }
- print "> visible | ";
- print "n<input class='romanCheck' id='romanCheck' type='checkbox' name='isRoman' value='1'";
- if ($isRoman == 1) {
- print " checked";
- }
- print "> uses Roman numeralsn";
- print "<span id='romanDisplay'>(XX)</span></td>n</tr>n";
- ?>
- </table>
- <button type='submit' name='process' value='update'>Update</button><br/>
- </form>
- </body>
- $( elements ).on( events, selector, data, handler );
- $(document).on("change", "span.iterationField input" ,function() { //code here });
- $(document).on("change", ".romanCheck" ,function() { //code here });
- $(document).ready(function(){
- $("input.romanCheck").on("change",function() {
- alert("#romanCheck.click has been hit");
- var romanValue = "";
- var roman = $("#romanCheck").is(':checked');
- if ( roman ) {
- var itValue = $(this).val();
- romanValue="(" + romanize(itValue) +")";
- }
- $("#romanDisplay").text(romanValue);
- });
- });
- $(document).change("input.romanCheck", function() {
- var romanValue = "";
- var roman = $("#romanCheck").is(':checked');
- if ( roman ) {
- var itValue = $("#iterationField").val();
- romanValue="(" + romanize(itValue) +")";
- }
- $("#romanDisplay").text(romanValue);
- });
- $(document).change("input.iterationField", function() {
- var romanValue = "";
- var roman = $("#romanCheck").is(':checked');
- if ( roman ) {
- var itValue = $("#iterationField").val();
- romanValue="(" + romanize(itValue) +")";
- }
- $("#romanDisplay").text(romanValue);
- });
- print
- "<input id='iterationField' type='text' name='iteration' value='";
- print $iteration . "'/>";
- print
- "<input id='romanCheck' type='checkbox' name='isRoman' value='1'";
- if ($isRoman == 1) {
- print " checked";
- }
- print ">";
- print "<span id='romanDisplay'>";
- if ($isRoman == 1) {
- print "(" . $romanIteration . ")";
- }
- print "</span>";
- function romanclick(){
- //if event fire twice use namespace at 1. and 2. and put $(document).off('namespace') here
- //your code romanclick
- $('span.iterationField input').click(function(){
- textchange();// call it again
- });
- }
- function textchange(){
- //if event fire twice use namespace at 1. and 2. and put $(document).off('namespace') here
- //change text code
- $('.romancheck').click(function(){
- romanclick();// call it again
- });
- } ;
- 1.$(document).on("change", "span.iterationField input" ,function() { //call your function here });
- 2.$(document).on("change", ".romanCheck" ,function() { //call your function here });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement