You need to sign in to do that
Don't have an account?
JQuery with visualforce component
So I have an <apex:inputText id="email"> tag in one of my visualforce pages. I'm trying to access it from one of my jquery functions to do some styling on it when the document loads. However, for some reason none of the styling is applied from the jquery function. I'm doing the following:
<script>
$(document).ready(function(){
...
var value = $("#emailComponent").val();
$("#" + value).style...
...
});
</script>
...
<apex:inputText id="email"/>
<input type="hidden" value="{!$Component.email}" id="emailComponent"/>
If I change the apex tag to a standard html input field, the jquery works. Can someone help me figure out why my jquery styling isn't applied to the apex tag?
I considered that, but it was going to require too many changes. However I solved my issue by finding out that you have to escape the colons ':' after passing the id into a jquery function. Issue solved :)
All Answers
Instead of using your hidden input, I would recommend giving the inputText a unique CSS class. That way you can just use the jquery class selector directly.
For example:
Regards,
Mark
I considered that, but it was going to require too many changes. However I solved my issue by finding out that you have to escape the colons ':' after passing the id into a jquery function. Issue solved :)
can you put some clear example for apex tag selectors?
Hi,
I'm facing something similar issue, could you please share the solution.
Thanks a ton inadvance !