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:body>
<h:form id="frmRegistration">
<h:panelGrid columns="2" rules="rows">
<h:outputLabel id="lblFirstName" value="First Name"  />
<h:inputText id="txtFirstName" value="#{memberRegisterBean.member.name}" 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

String Ordered Permutation Algorithm Problem

Implementing tokenizer and adding tokens to the linked list

binary tree problems with solution

Kadane’s algorithm in C – Dynamic Programming

Implement Queue Using two Stacks – JavaScript algorithm

Changing decimal number to its binary equivalent

Finding missing numbers from billion sequential number list file

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

Find the first occurence of number in the sorted array

testing k complementary pairs algorithm with junit

Leave a Reply

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

*
*