javascript - What can override the attributes in an html input? -


i outputing values want html input php. reason not recognizing min , step attributes. how can html attributes overridden?

edit - customizing anspress wordpress. here link through files plugin.

any thoughts??

html structures output (ap_ask_form() in php code below)

<div id="ap-form-main" class="active ap-tab-item">     <?php ap_ask_form(); ?> </div> 

ask_form.php

class anspress_ask_form {     public function __construct()     {         add_filter('ap_ask_form_fields', array($this, 'ask_form_name_field'));     }      public function ask_form_name_field($args){         if(!is_user_logged_in() && ap_opt('allow_anonymous'))             $args['fields'][] = array(                 'name' => 'name',                 'label' => __('name', 'ap'),                 'type'  => 'text',                 'placeholder'  => __('enter name display', 'ap'),                 'value' => sanitize_text_field(@$_post['name'] ),                 'order' => 12             );          return $args;     } }  new anspress_ask_form;  /**  * generate ask form  * @param  boolean $editing  * @return void  */ function ap_ask_form($editing = false){     global $editing_post;      $is_private = false;     if($editing){         $is_private = $editing_post->post_status == 'private_post' ? true : false;     }      $args = array(         'name'              => 'ask_form',         'is_ajaxified'      => true,         'submit_button'     => ($editing ? __('update question', 'ap') : __('post question', 'ap')),         'fields'            => array(             array(                 'name' => 'title',                 'label' => __('title', 'ap'),                 'type'  => 'text',                 'placeholder'  => __('question in 1 sentence', 'ap'),                 'desc'  => __('write meaningful title question.', 'ap'),                 'value' => ( $editing ? $editing_post->post_title : sanitize_text_field( @$_post['title'] ) ),                 'order' => 5,                 'attr' => 'data-action="suggest_similar_questions"',                 'autocomplete' => false,             ),             array(                 'name' => 'title',                 'type'  => 'custom',                 'order' => 5,                 'html' => '<div id="similar_suggestions"></div>'             ),             array(                 'name' => 'description',                 'label' => __('description', 'ap'),                 'type'  => 'editor',                 'desc'  => __('write description question.', 'ap'),                 'value' => ( $editing ? apply_filters('the_content', $editing_post->post_content) : @$_post['description']  ),                 'settings' => apply_filters( 'ap_ask_form_editor_settings', array(                     'textarea_rows'     => 8,                     'tinymce'           => ap_opt('question_text_editor') ? false : true,                     'quicktags'         => ap_opt('question_text_editor') ? true : false ,                     'media_buttons'     =>false,                 )),             ),             array(                 'name'  => 'ap_upload',                 'type'  => 'custom',                 'html' => ap_post_upload_form(),                 'order' => 10             ),             array(                 'name' => 'parent_id',                 'type'  => 'hidden',                 'value' => ( $editing ? $editing_post->post_parent : get_query_var('parent')  ),                 'order' => 20             )         ),     );      if(ap_opt('allow_private_posts'))         $args['fields'][] = array(             'name' => 'is_private',             'type'  => 'checkbox',             'desc'  => __('only visible admin , moderator.', 'ap'),             'value' => $is_private,             'order' => 12,             'show_desc_tip' => false         );      if(ap_opt('recaptcha_site_key') == '')         $recaptcha_html = '<div class="ap-notice red">'.__('recaptach keys missing, please add keys', 'ap').'</div>';     else         $recaptcha_html = '<div class="g-recaptcha" id="recaptcha" data-sitekey="'.ap_opt('recaptcha_site_key').'"></div><script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl='.get_locale().'&onload=onloadcallback&render=explicit"  async defer></script><script type="text/javascript">var onloadcallback = function() {         widgetid1 = grecaptcha.render("recaptcha", {           "sitekey" : "'.ap_opt('recaptcha_site_key').'"         });       };</script>';      if(ap_opt('enable_recaptcha'))         $args['fields'][] = array(             'name' => 'captcha',             'type'  => 'custom',             'order' => 100,             'html' => $recaptcha_html         );      /**      * filter: ap_ask_form_fields      * filter modifying $args      * @var array      * @since  2.0      */     $args = apply_filters( 'ap_ask_form_fields', $args, $editing );      if($editing){         $args['fields'][] = array(             'name'  => 'edit_post_id',             'type'  => 'hidden',             'value' => $editing_post->id,             'order' => 20         );     }      $form = new anspress_form($args);      echo $form->get_form();     echo ap_post_upload_hidden_form(); }  /**  * generate edit question form, wrapper of ap_ask_form()  * @return void  * @since 2.0.1  */ function ap_edit_question_form() {     ap_ask_form(true); } 

my extension plugin using wordpress hook "plugins_loaded" (the ask_form_amount_field($args, $editing) below part of class made; if me post can, trying show relevant info without making lengthy...)

public function ask_form_amount_field($args, $editing){         if(wp_count_terms('question_amount_field') == 0)             return $args; //taxonomy stuff?          global $editing_post;          if($editing){             $amount_field = get_the_terms( $editing_post->id, 'question_amount_field' );             $amount_field = $amount_field[0]->term_id;         } //more things purely related taxonomy, seems.          $args['fields'][] = array(             'name' => 'amount_field',             'label' => __('amount field label', 'amount_field_for_anspress'),             'type'  => 'number',             'value' => ( $editing ? $amount_field :  sanitize_text_field(@$_post['amount_field'] )),              'taxonomy' => 'question_amount_field',             'orderby' => ap_opt('form_amount_field_orderby'),             'desc' => __('enter amount wish tip fulfilling request.', 'amount_for_anspress'),             'order' => 7,             'min' => 0.50,             'step' => 0.25         );          return $args;      }  }}//the class ends here; beginning not shown above  function find_do_for_anspress() {     $discounts = new find_do_for_anspress(); } add_action( 'plugins_loaded', 'find_do_for_anspress' ); 

here's shorter javascript solution jquery, please note may need change $ jquery because of how wordpress implements jquery

//set values minvalue = 100; stepvalue = 100;  //select element id, update min attribute $("#my-element-id").attr("min", minvalue);  //select element id, update step attribute $("#my-element-id").attr("step", minvalue); 

here's documentation on jquery attr() more information, can used and/or set attributes: https://api.jquery.com/attr/


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -