You need to sign in to do that
Don't have an account?
accessing the id of the nested element using jQuery in visualforce pages
Hi ,
I am having problem in accessing the id of the element using jQuery, what is the accurate method to access the interna or nested elements
in the visualforce using jQuery.
I am having problem in accessing the id of the element using jQuery, what is the accurate method to access the interna or nested elements
in the visualforce using jQuery.
<script> $(document).ready(function(){ $("#createUserLink").click(function() { alert('hello'); }); }); </script> </head> <apex:form id="popupForm"> <div id="lean_overlay"> <table> <tr> <td><apex:outputLabel value="Enter customer name:"></apex:outputLabel></td> <td> <apex:inputtext value="{!cust_name}"/> </td> </tr> <tr> <td><apex:outputLabel value="Enter customer contact number:"></apex:outputLabel></td> <td><apex:inputText value="{!cust_contact}"/> </td> </tr> <tr> <td><apex:outputLabel value="Enter customer email"></apex:outputLabel></td> <td><apex:inputText value="{!cust_email}"/></td> </tr> <tr> <td><apex:outputLabel value="Enter customer's address"></apex:outputLabel> </td> <td><apex:inputText value="{!cust_address}"/></td> </tr> <tr><td><apex:commandButton value="submit" id="submitButton"/> </td> <td><apex:commandButton value="Cancel" id="cancelButton"/></td> </tr> </table> </div> <a href="#" id="createUserLink">Create User </a> // This element not accessible </apex:form> <a href="#" id="createUserLink">Create User </a> // same element working fine </apex:page>what is the exact way to access the id of nested element.
Can you change your code to do this instead. and remove the <a> in line 43.
Please use this code to access the element inside the form:
$(document).ready(function(){
$(" [id$=popupForm] [id$=createUserLink]").click(function() {
console.log('hello');
});
Please mark it as best answer if it solves your problem.
Regards,
Grazitti Team
Thanks for your quick reply.
the way you are telling me here is not referring my question, You are just telling me to select the multiple elements at a time and perform
the action.
But my question was how to access multiple level of nested element using jquery in visualforce.
Thanks
Could you please give an example of any element in your markup which you are trying to access and are unable to?
I'd imagine what is happening is that the last item on the page with the duplicate id wins.