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 8380493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:28:21+00:00 2026-06-09T16:28:21+00:00

I need to check if button in jsp page is clicked. I have 1

  • 0

I need to check if button in jsp page is clicked.

I have 1 jsp page and 2 JavaScript page. First JSP page is an index which takes input from user and send to javascript1, javascript1 then query it and output back in index page with buttons was embedded on each output.
What I want is, if user click one particular button, javascript2 will detect the click and taking value of that particular button to be next search query and again display the result back at index page.

Here is my code :

INDEX.JSP

<div>Please enter search keyword</div>
<input type="text" name="valueLiteral" class="input-box"/><br>
<input type="submit" name="indexsearch" value="Search" class="input-button">

Which javascript1 will detect if input name "indexsearch" is clicked and take value name "valueLiteral" to query out the result.
This part work just fine.

Here is code in Javascript1.js:

$(document).ready(function() {
$("#result").hide();
$("input[name='indexsearch']").click(function() {
    and so on.......
    var stmt = [];
          
     $.each(arrayPredicate, function(k,v){
     stmt[k] = "<span class='subject' id="+arraySubject[k]+">" + arraySubject[k] + "</span> " + " -> " + v + " : "+ "<span class='object'>" + arrayObject[k] + "</span>" + "**<input type = 'submit' class = 'searchAgain-button' name = 'searchMore' value = " + arrayObject[k] + "></input>**<br><br>";
     });
            stmt = stmt.sort();
            $.each(stmt, function(k,v){
                $("#result").append(v);
            });
        } else {
            var $noresult = "No Result : Please enter a query";
            $("#result").append($noresult);
        }
    });

As you have seen, I created buttons and append it to the end of each search result. This part still works (button appears and display the name of the next query).

Here is the last part of code : Javascript2.js:

    $(document).ready(function() {
    $("input[name='searchMore']").click(function() {
    
    $("#result").show();
    $("#result").empty();

    loading_img();
    var $textInput = $(this).attr("Value");
 
            var stmt = [];
            //concat all related array into string (create triple statement)
            $.each(arrayPredicate, function(k,v){
                stmt[k] = "<span class='subject' id="+arraySubject[k]+">" + arraySubject[k] + "</span> " + " -> " + v + " : "+ "<span class='object'>" + arrayObject[k] + "</span><input type = 'submit' class = 'searchAgain-button' name = 'searchMore' value = " + arrayObject[k] + "></input><br><br>";
            });
            stmt = stmt.sort();
            $.each(stmt, function(k,v){
                $("#result").append(v);
            });
        } else {
            var $noresult = "No Result : Please enter a query";
            $("#result").append($noresult);
        }
    });        
});

Those above code is not work, after some testing I think this JavaScript page can not detect that the button name "searchMore". And eventually make other part of code not work.

Any suggestion?

  • 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-09T16:28:23+00:00Added an answer on June 9, 2026 at 4:28 pm

    Have you try

    $("input[name='searchMore']").live("click", function() { ...
    

    ?

    In
    http://api.jquery.com/live/

    Description: Attach an event handler for all elements which match the current selector, now and in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form in which there are 5 inputs I need to check From
Here i need to check a button click using javascript i.e)if button A is
I need to check if a user (visitor) liked my Facebook page ( a
I need to check the user input in the preferences if they want to
I have two textfields in HTML, when a button is clicked, I need to
Right now I have 4 checkboxes and I need to check if they're un-clicked.
When the page is loading for the first time, I need to check if
On mouse-down (and up) I need to check which mouse button has changed its
I have two frames in my page. The upper frame is a jsp which
I need to check in my portlet wich language does an user have selected

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.