Skip to main content

Get the sharepoint form Field ID In javascript.

Dear Readers
I have a SharePoint notefield control(in my page layout) and trying to get the ID of the of the control using JavaScript.

In ASPX:

<SharePointWebControls:notefield FieldName="INFO_x0020_Document_x0020_Title" runat="server" InputFieldLabel="Enter a question. For example, FAQ: <Question>?" CssClass="notefieldStyle"></SharePointWebControls:NoteField>

In HTML(after Rendering)

<textarea name="ctl00$PlaceHolderMain$ctl00$ctl00$TextField" rows="2" cols="20" id="ctl00_PlaceHolderMain_ctl00_ctl00_TextField" title="INFO_Document_Title" class="notefieldStyle" dir="none">dfsdfdsfsdf</textarea>

Here is a solution: 
alert($("input[title='INFO_Document_Title']").attr('ID'));

or this one

// get the element with the title 'Info_Document_Title'
var myspfield = $(" [title='INFO_Document_Title']");
// get the id of the element.
var idOfMyspfield = myspfield.attr("id");

I hope it helps you alot
Regards
Rashid Imran Bilgrami
CEO Best visualization
www.bestvisualization.com

Comments