.= 'tag.htm'; break; case 'flag': $pre .= $default_pre .= 'flag.htm'; break; case 'my': $pre .= $default_pre .= 'my.htm'; break; case 'my_password': $pre .= $default_pre .= 'my_password.htm'; break; case 'my_bind': $pre .= $default_pre .= 'my_bind.htm'; break; case 'my_avatar': $pre .= $default_pre .= 'my_avatar.htm'; break; case 'home_article': $pre .= $default_pre .= 'home_article.htm'; break; case 'home_comment': $pre .= $default_pre .= 'home_comment.htm'; break; case 'user': $pre .= $default_pre .= 'user.htm'; break; case 'user_login': $pre .= $default_pre .= 'user_login.htm'; break; case 'user_create': $pre .= $default_pre .= 'user_create.htm'; break; case 'user_resetpw': $pre .= $default_pre .= 'user_resetpw.htm'; break; case 'user_resetpw_complete': $pre .= $default_pre .= 'user_resetpw_complete.htm'; break; case 'user_comment': $pre .= $default_pre .= 'user_comment.htm'; break; case 'single_page': $pre .= $default_pre .= 'single_page.htm'; break; case 'search': $pre .= $default_pre .= 'search.htm'; break; case 'operate_sticky': $pre .= $default_pre .= 'operate_sticky.htm'; break; case 'operate_close': $pre .= $default_pre .= 'operate_close.htm'; break; case 'operate_delete': $pre .= $default_pre .= 'operate_delete.htm'; break; case 'operate_move': $pre .= $default_pre .= 'operate_move.htm'; break; case '404': $pre .= $default_pre .= '404.htm'; break; case 'read_404': $pre .= $default_pre .= 'read_404.htm'; break; case 'list_404': $pre .= $default_pre .= 'list_404.htm'; break; default: $pre .= $default_pre .= theme_mode_pre(); break; } if ($config['theme']) { $conffile = APP_PATH . 'view/template/' . $config['theme'] . '/conf.json'; $json = is_file($conffile) ? xn_json_decode(file_get_contents($conffile)) : array(); } !empty($json['installed']) and $path_file = APP_PATH . 'view/template/' . $config['theme'] . '/htm/' . ($id ? $id . '_' : '') . $pre; (empty($path_file) || !is_file($path_file)) and $path_file = APP_PATH . 'view/template/' . $config['theme'] . '/htm/' . $pre; if (!empty($config['theme_child']) && is_array($config['theme_child'])) { foreach ($config['theme_child'] as $theme) { if (empty($theme) || is_array($theme)) continue; $path_file = APP_PATH . 'view/template/' . $theme . '/htm/' . ($id ? $id . '_' : '') . $pre; !is_file($path_file) and $path_file = APP_PATH . 'view/template/' . $theme . '/htm/' . $pre; } } !is_file($path_file) and $path_file = APP_PATH . ($dir ? 'plugin/' . $dir . '/view/htm/' : 'view/htm/') . $default_pre; return $path_file; } function theme_mode_pre($type = 0) { global $config; $mode = $config['setting']['website_mode']; $pre = ''; if (1 == $mode) { $pre .= 2 == $type ? 'portal_category.htm' : 'portal.htm'; } elseif (2 == $mode) { $pre .= 2 == $type ? 'flat_category.htm' : 'flat.htm'; } else { $pre .= 2 == $type ? 'index_category.htm' : 'index.htm'; } return $pre; } ?>javascript - JQuery validation not working in IE 11 - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - JQuery validation not working in IE 11 - Stack Overflow

programmeradmin1浏览0评论

I am trying to validate a form using jquery validate with PHP. I have done all this using google......I am new to the web development.The form is working absolutely fine in FF but the script is not wotking in IE 11..HELP ME...THANKS... The code is given below:

<script src="js/jquery-1.9.0.js"></script>

  <script src="js/jquery.validate.min.js"></script>

  <!-- jQuery Form Validation code -->
  <script>

  // When the browser is ready...


 $function() {

    // Setup form validation on the #register-form element
    $("#register-form").validate({

        // Specify the validation rules
        rules: {
            topic: "required",
            detail: "required",
            name: "required",
            email: {
                required: true,
                email: true
            },

        },

        // Specify the validation error messages
        messages: {
            topic: "Enter the subject for your suggestion",
            detial: "Please enter your suggestion",
            name: "Please enter your name. It will be kept hidden",
            email: "Please enter a valid email address",
           /* username: "Please enter a valid username",
            password: {
                required: "Please provide a password",
                minlength: "Your password must be at least 5 characters long"
            }*/
        },

        submitHandler: function(form) {
            form.submit();
        }
    });

  });

  </script>



<table align="center" width="800px" border="1" class="table_css">
  <?php echo $output; ?>
  <!--  The form that will be parsed by jQuery before submit  -->
  <tr><td  >Submit Your Suggestion</td></tr>
  <tr><td>
  <form action="add_topic.php" method="post" id="register-form"  name="register-form" novalidate>

    <div class="label">Subject</div><input type="text" id="topic" name="topic" value="<?php echo $topic; ?>" size="50"/><br />
    <div class="label">Suggestion</div>
    <textarea name="detail" cols="60"  id="detail" rows="15" value="<?php echo $detail; ?>"></textarea><br />

    <div class="label">Name</div><input type="text" id="name" name="name" value="<?php echo $name; ?>" size="30" /><br/>
    <div class="label">Email</div><input type="text" id="email" name="email" value="<?php echo $email; ?>" size="30"/><br /><div style="margin-left:200px;"><input type="submit" name="submit" value="Submit" /><input type="reset" name="Submit2" value="Reset" /></div>
    </form>
  </td>
  </tr>
  </table>

I am trying to validate a form using jquery validate with PHP. I have done all this using google......I am new to the web development.The form is working absolutely fine in FF but the script is not wotking in IE 11..HELP ME...THANKS... The code is given below:

<script src="js/jquery-1.9.0.js"></script>

  <script src="js/jquery.validate.min.js"></script>

  <!-- jQuery Form Validation code -->
  <script>

  // When the browser is ready...


 $function() {

    // Setup form validation on the #register-form element
    $("#register-form").validate({

        // Specify the validation rules
        rules: {
            topic: "required",
            detail: "required",
            name: "required",
            email: {
                required: true,
                email: true
            },

        },

        // Specify the validation error messages
        messages: {
            topic: "Enter the subject for your suggestion",
            detial: "Please enter your suggestion",
            name: "Please enter your name. It will be kept hidden",
            email: "Please enter a valid email address",
           /* username: "Please enter a valid username",
            password: {
                required: "Please provide a password",
                minlength: "Your password must be at least 5 characters long"
            }*/
        },

        submitHandler: function(form) {
            form.submit();
        }
    });

  });

  </script>



<table align="center" width="800px" border="1" class="table_css">
  <?php echo $output; ?>
  <!--  The form that will be parsed by jQuery before submit  -->
  <tr><td  >Submit Your Suggestion</td></tr>
  <tr><td>
  <form action="add_topic.php" method="post" id="register-form"  name="register-form" novalidate>

    <div class="label">Subject</div><input type="text" id="topic" name="topic" value="<?php echo $topic; ?>" size="50"/><br />
    <div class="label">Suggestion</div>
    <textarea name="detail" cols="60"  id="detail" rows="15" value="<?php echo $detail; ?>"></textarea><br />

    <div class="label">Name</div><input type="text" id="name" name="name" value="<?php echo $name; ?>" size="30" /><br/>
    <div class="label">Email</div><input type="text" id="email" name="email" value="<?php echo $email; ?>" size="30"/><br /><div style="margin-left:200px;"><input type="submit" name="submit" value="Submit" /><input type="reset" name="Submit2" value="Reset" /></div>
    </form>
  </td>
  </tr>
  </table>
Share Improve this question edited May 5, 2014 at 13:07 Getz 4,0636 gold badges37 silver badges52 bronze badges asked May 5, 2014 at 13:06 user3604281user3604281 111 gold badge1 silver badge2 bronze badges 1
  • Why don't you simply use "required" in input ? you don't need jQuery to do it :) – Dev'Hamz Commented May 5, 2014 at 13:09
Add a ment  | 

5 Answers 5

Reset to default 4

I had the similar issue. I added the following code to set browser patibility for Internet Explorer to make it run. Add the following code in <head> tag.

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

It makes the script to work in IE11.

You can simply use the keyword "required" HTML5.

<input type="text" required>

DEMO HERE

Change the name of the submit button

<input type="submit" name="submit" value="Submit" />

to something other than submit.

<input type="submit" name="btnSubmit" value="Submit" />

From another thread, it looks like IE doesn't handle excessive mas well. Try removing the ma after the email properties in the messages and rules objects.

https://github./jquery-validation/jquery-validation/issues/2225 problems in version 1.18.0

a safe solution would be to install version 1.17.0 -> npm install [email protected] and check if the plugin really is with version 1.17.0

发布评论

评论列表(0)

  1. 暂无评论