aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Onclick Event of <li> tag Not Fireing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Onclick Event of <li> tag Not Fireing" Watch "Onclick Event of <li> tag Not Fireing" New topic
Author

Onclick Event of <li> tag Not Fireing

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1475
    
    1
I am trying to get a combo box list item onclick event to fire js function but nothing is working:

Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
What do you mean with "nothing is working"? Does the function gets invoked?
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1475
    
    1
Albareto McKenzie wrote:What do you mean with "nothing is working"? Does the function gets invoked?


It was not firing the function at all but I finally figured that the click event was tied to jquery function and I added my function to that call.

But in my call I am using AJAX to set a value in a dropdown tag. The tag is dynamicly populated using jstl with a value and display test. I can get the value to set correctly but how do I get the display to show the associated text.

The dropdown is populated as such:

value 1 Text L-R
value 2 Text L-CTR-R
value 3 Text L-CTRL-CRTR-R

If my AJAX callback sets the value of the drop down to 2 how do I get the tag to display L-CTR-R?
Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
I don't really understand the problem, you have a list with onclick event in the elements, then you also have a selection box (dropdown) but I still don't get what you want to show where and when.

What is "the tag" in this sentence : "how do I get the tag to display L-CTR-R?"
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Looking at serverside markup is no help. Show what the browser receives.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1475
    
    1
Eric Pascarello wrote:Looking at serverside markup is no help. Show what the browser receives.


My web app is built using div tags and $.load. SO when I do a display of the source code in the browser I only get the index.jsp code no matter where I am at in the application. I am using IE8. How do I get the source code from what ever page I am on?
Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
You can use Developer Tools (press F12 or go to tools > Developer Tools)
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1475
    
    1
Steve Dyke wrote:
Albareto McKenzie wrote:What do you mean with "nothing is working"? Does the function gets invoked?


It was not firing the function at all but I finally figured that the click event was tied to jquery function and I added my function to that call.

But in my call I am using AJAX to set a value in a dropdown tag. The tag is dynamicly populated using jstl with a value and display test. I can get the value to set correctly but how do I get the display to show the associated text.

The dropdown is populated as such:

value 1 Text L-R
value 2 Text L-CTR-R
value 3 Text L-CTRL-CRTR-R

If my AJAX callback sets the value of the drop down to 2 how do I get the tag to display L-CTR-R?


I have an input form with four inputs:

A tail number,
line number,
configuration number(drop down, value - display),
Example:
value 1 Text L-R
value 2 Text L-CTR-R
value 3 Text L-CTRL-CRTR-R

starting row number.

When I click submit these values are stored. The configuration is stored as the value.

Now when the user opens the form the bext time they will have a combo box where they can type in new info or select a previous entry by the tail number. When the form populates using AJAX I need the configuration(drop down box) to display L-CTR-R since the value of 2 was stored and then subsequently retrevied by the AJAX call.
Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
you have to tell the dropdown which option is the selected, with raw Javascript it would be something like this:


Fully untested code, but you get the idea. In jQuery and other libraries there is a build in way to do it.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Steve Dyke wrote:My web app is built using div tags and $.load.


load means you are using a GET request so load the page! ;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Onclick Event of <li> tag Not Fireing