Reputation: 187
I'm using the jQuery Placeholder plugin on my forms, everything works perfectly on the asp.net page; and on my masterpage I have all the correct .ClientID settings so my jQuery Validation is works.
The issue I am having is that to initialise the placeholder script you use:
$('input, textarea').placeholder();
Is there a way for me to get this working on a masterpage, I tried calling
<%=txtFirstName.UniqueID %>.placeholder()
with no luck, is there a way to get this working?
Sorry guys I made a mistake; the placeholder is on a TextBox.
All help is greatly appreciated.
Matt
Upvotes: 0
Views: 377
Reputation: 6414
I can only imagine that your ddlFirstHome.UniqueID
attribute returns a string with the ID of the element you want to add a placeholder to. Something like FirstHome
. So you would need to select it with jQuery...
$("#FirstHome").placeholder();
Adding in the ASP.NET placeholder you get...
$("#<%=ddlFirstHome.UniqueID %>").placeholder();
EDIT Forget the above, you should be able to run the plugin on all inputs and textareas indiscriminately. Presumably in your master page you have a html head tag or you are including it in your template somewhere. Just add...
<script type="text/javascript">
// Run on document ready
$(function() {
// target all inputs and textareas with the attribute placeholder
// and enable cross-browser placeholders
$("input[placeholder],textarea[placeholder]").placeholder();
});
</script>
Upvotes: 1
Reputation: 23208
Modified code: try this
$("#<%=ddlFirstHome.UniqueID %>").placeholder()
Upvotes: 1