Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8746301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:10:22+00:00 2026-06-13T12:10:22+00:00

<input id=UploadButton type=button value=Upload onclick=xyz/> <script language=javascript type=text/javascript> $(function () { $().SPServices({ operation: GetList,

  • 0
<input id="UploadButton" type="button" value="Upload" onclick="xyz"/> 

<script language="javascript" type="text/javascript">
    $(function () {
        $().SPServices({
            operation: "GetList",
            listName: "Docs",
            async: false,
            completefunc: function (xData, Status) {
                id = $(xData.responseXML).find("List").attr("ID");
            }
        });

        reference = "./_layouts/Upload.aspx?List=" + id + "&amp;RootFolder=";
        $('#UploadButton2').attr("href", reference);
        alert($('#UploadButton2').attr("href"));

        js = "javascript:" + "NewItem2(event, &quot;" + reference + "&quot;);javascript:return false;";
        $('#UploadButton').attr("onclick", js);
        alert($('#UploadButton').attr("onclick"));
    });
</script>    

I’ve found several things or solutions they would fit to my problem but it won’t work.

I just want to set or change the “onclick”-Event for the Input type (id=UploadButton) and

alert($('#UploadButton').attr("onclick"));

gives me the string from “js”. So far so good… But if I click on the UploadButton nothing happens. It seems that the browser won’t recognize the change. The solution in my current code ins´t the only one I tried out over last few hours. One of the solutions I’ve tried was to use so .click() method of jQuery, but I can´t call the “NewItem2()” function over .click(), do I?
My primary target is to call the “NewItem2()” function over the UploadButton with the information of the string “reference”. Unfortunately NewItem2() is a function of Sharepoint so there is no code inside written with my hands but if I set the attribute onclick hard in the code, the button is working perfectly :-/

I’ve seen so many different solutions over the last time but nothing won’t fit for me but I think the failure is on my site.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:10:23+00:00Added an answer on June 13, 2026 at 12:10 pm

    You have your call to NewItem2 as a string, you will have better luck changing

    js = "javascript:" + "NewItem2(event, &quot;" + reference + "&quot;);javascript:return false;";
    $('#UploadButton').attr("onclick", js);
    

    to

    $('#UploadButton').click( function (event) {
        NewItem2(event, reference);
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this script to upload my image files: http://jsfiddle.net/eHmSr/ $('.uploader input:file').on('change', function() {
Input rz value In the head I have: Event.observe(window, 'load', function() { $$(input).each(function(field){ Event.observe(field,
when my ajaxupload script finishes it adds a read-only input w/ the value of
I'm using the following input field <input class=upload_button type=file multiple= name=userfile> To upload multiple
Here's my button: <p>File Uploaded:</p><fieldset><div id='fileloc'>PROGRAMMATICALLY INSERTED LINK TO FILE <button type='button' onclick='fileDelete()'>Delete</button></div></fieldset> And
A sample of my code is here: http://develop.davzy.com/test2.php <input name=avatarfile type=file id='uploadbutton' /> <script>document.getElementById(uploadbutton).click()</script>
I have a a form which contains a file input, upload button and cancel
Input: I have a LaTeX file, with plain text & math formulas. Desired output:
I tried to change the HTML form, input type file. Here is my code:
I want to have image button for browse and upload I have textbox using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.