Last active
August 29, 2015 14:21
-
-
Save jkentjnr/b775f63e6898dbd57f3f to your computer and use it in GitHub Desktop.
Blog - USING JQUERY TO REFERENCE AN INPUT IN VISUALFORCE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:form id="form"> | |
<apex:pageBlock id="blockContact" mode="edit"> | |
<apex:pageBlockSection id="blockDetails" title="Details"> | |
<apex:inputField id="inputContactName" value="{!Contact.Name}" /> | |
</apex:pageBlockSection> | |
</apex:pageBlock> | |
</apex:form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input id="j_id0:form:blockContact:blockDetails:inputContactName" type="text" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var o = document.getElementById('j_id0:form:blockContact:blockDetails:inputContactName'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" /> | |
<script type="text/javascript"> | |
j$ = jQuery.noConflict(); | |
j$(document).ready(function() { | |
// The dollar sign after the id attribute tells jQuery to return any elements | |
// with an id that end in 'ContactName' | |
var o = j$('input[id$=ContactName]').val(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment