Using JSF form fields with jQuery – Can’t use jQuery with : (colon) problem

Using JSF form fields with jQuery – Can’t use jQuery with : (colon) problem

if you have a jsf page of the following

<h:form id="frmRegistration">
<h:panelGrid columns="2" rules="rows">
<h:outputLabel id="lblFirstName" value="First Name"  />
<h:inputText id="txtFirstName" value="#{}" label="First Name" required="true"/>

And say you want assign default value from javascript to the text box you would use:

    $("#frmRegistration:txtFirstName").val("this val");

Since that is how JSF would generate the id of the component
But, you wont see any effect as jQuery don’ like the generated colon (:).
use this instead> ‘escape it’

    $("#frmRegistration\:txtFirstName").val("this val");

See how you would solve these known algorithm problems

Implementing tokenizer and adding tokens to the linked list

Finding missing numbers from billion sequential number list file

Find the first occurence of number in the sorted array

Changing decimal number to its binary equivalent

testing k complementary pairs algorithm with junit

Java solution for checking anagram strings – tell if phrases are anagrams

String Ordered Permutation Algorithm Problem

Find K Complementary numbers from array Java implementation

binary tree problems with solution

Find the pairs that makes K Complementary in the given array java solution

Leave a Reply

Your email address will not be published. Required fields are marked *