SharePoint & jQuery

No doubt that jQuery is one of the best things to use in web development.
But when using it in SharePoint it’s a little bit tricky.
SharePoint always puts this in front of your control id: ‘ctl00$PlaceHolderMain$’ depending on which placeholder you placed your control.
When you need to access a control in jQuery in SharePoint your have to write a jQuery filter which is thinking about performance not always the best way to go.

Filter example:

$(“[id$=control_id]”)This filter will look for al controls were the id ends with your control id.
Using this filter will work perfect although writing it again and again pff…

Using this function will save you some time:

function GetSharePointNotation(control) {
return“[id$='” + control + “‘]”;


Using the function:

$(GetSharePointNotation(“control id”)).show();


Have fun






Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen. logo

Je reageert onder je account. Log uit /  Bijwerken )

Google photo

Je reageert onder je Google account. Log uit /  Bijwerken )


Je reageert onder je Twitter account. Log uit /  Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit /  Bijwerken )

Verbinden met %s