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

Find the first occurence of number in the sorted array

Finding missing numbers from billion sequential number list file

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

testing k complementary pairs algorithm with junit

String Ordered Permutation Algorithm Problem

Implementing tokenizer and adding tokens to the linked list

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

Find longest palindrom from sequence of characters

Changing decimal number to its binary equivalent

binary tree problems with solution

Leave a Reply

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