I can use jquery to change html input tag's placeholder for no problem, but no
matter what method I use, impossible for me to change
s:textfield's placeholder.
I tried
$('#partid').attr('placeholder','XXX');
and
$('#partid').val('XXX');
and
$('#partid').text('XXX');
s:textfield's placeholder impossible for jquery to change, is struts2 limition
or bugs?
thanks in advance
john
*************************************************************
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<sj:head jqueryui="true"/>
<script language="javascript">
$(document).ready(function() {
$('#searchchoice').change(function() {
var ex = document.getElementById("searchchoice");
var finalchoice = ex.options[ex.options.selectedIndex].text;
if (finalchoice=='part#')
$('#partid').attr('placeholder','input example: XXX');
else if (finalchoice=='keyword')
$('#partid').attr('placeholder','input example 2: XXX');
else if (finalchoice=='model')
$('#partid').attr('placeholder','input example 3: XXX');
});
});
</script>
<s:form class="nav-search" action="PartsearchbothAction" method="post"
theme="simple" >
<s:select label="Part#"
id="searchchoice"
name="searchchoice"
list="#{'part#':'part#', 'keyword':'keyword', 'model#':'model'}"
value="part#"
theme="simple"
required="true"
/>
<s:textfield name="partid" label="partid" placeholder='default search is
by Part#' required="true" theme="simple"/>
<s:submit value="go">
</s:form>