Quantcast
Viewing all articles
Browse latest Browse all 6517

New Post: Add to List if not in Drop Down

Ahhh....so that dosent make sense, the $("select[title='Plans selected values']") in one spot, but noy in another. it must be the context the method is called from.

I suspect  when you're making the $("select[title='Plans selected values']") call that doesnt work, the document hasnt been fully loaded. Is your call wrapped in a $(document).ready(){} function? can you post your full code here?

The code in my blog is different from what I posted here, and I anwered your question  thinking you were using the method posted in the blog.

If youre adding the link via

<td>
<a  onclick="javascript:AddVendor()">Add Vendor</a>
</td>

the dom  may not have been loaded. Don't customize the html as described above, instead add the link using javascript as shown in the blog:

function setupAddNew() {
    //debugger;

    var selectTD = $("select[Title='Counterparty']").parent();
 
      selectTD.append('   ')//  this should be an <image src='whatever' onclick='javascript:addPlans()' /
    .append("Add Counterparty");

}

function documentLoaded() {
    setupAddNew();
    //debugger;
}
_spBodyOnLoadFunctionNames.push("documentLoaded");

The spBodyOnLoad.. stuff will call the documentLoaded function when every thing is ready. Document loaded wil call setupAddNew.  setupAddNew creates a link to the 'addPlans()' method.

 

 


Viewing all articles
Browse latest Browse all 6517

Trending Articles