How to change some text in a form using jquery -


i need change text in form "search listings type:" (translation in spanish "buscar listado por categoria")

<form action="" id="searchform" method="get" role="search">     <input type="hidden" name="s" value="">     <input type="hidden" name="post_type" value="listing">     <select style="float:left;" class="wp-listings-taxonomy custom_search" id="status" name="status">         <option selected="selected" value="">search listings type:</option>         <option value="features">featured</option>         <option value="new">new</option>         <option value="for-sale">for sale</option>         <option value="for-rent">for rent</option>     </select>     <div class="btn-search">         <button class="searchsubmit custom_button" type="submit">             <i class="fa fa-search"></i>             <span class="button-text">search listings</span>         </button>     </div>     <div class="clear"></div> </form> 

i thinking is:

$(document).ready(function(){     $( "#searchform option:selected" ).val("").text("buscar listado por categoria"); }); 

to set text? not working obvius missing something. how properly?

you can following.

$("#status option:first" ).text("buscar listado por categoria");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <form action="" id="searchform" method="get" role="search">      <input type="hidden" name="s" value="">      <input type="hidden" name="post_type" value="listing">      <select style="float:left;" class="wp-listings-taxonomy custom_search" id="status" name="status">          <option selected="selected" value="">search listings type:</option>          <option value="features">featured</option>          <option value="new">new</option>          <option value="for-sale">for sale</option>          <option value="for-rent">for rent</option>      </select>      <div class="btn-search">          <button class="searchsubmit custom_button" type="submit">              <i class="fa fa-search"></i>              <span class="button-text">search listings</span>          </button>      </div>      <div class="clear"></div>  </form>


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -