Trying to sent a var (myvar) from a hyperlink to jquery doesnt work in firefox only in IE. .live bug?
Hello all,
I'm trying to sent a var to my jquery script when i click on a hyperlink inside the search.php.
I had discovered that this will only work when using .live, but it wont work with firefox, chrome. It will only work in IE. Is there a workaround for this?
This is the situation:
Page 1: index.php -->main page with search input field.
Page 2: search.php -->contains search results and the hyperlink with the value i sent to the jquery.
This is the hyperlink: echo "<a href=\"#\" id=\"myhyperlink\" value=\"myvar\">Next</a>";
When i click on the hyperlink with firefox nothing happens. In IE it works.
This is my js code:
- //global var
- var order;
-
- var SearchFunction = function(e)
- {
- q=$("#q").val();
- $("#result").load("search.php?search="+q+"&order="+order);
- };
- $(document).ready(function() {
- $("#q").keyup(SearchFunction);
-
- $('#myhyperlink').live(
- {
- click: function()
- {
- order=$("#myhyperlink").val();
- alert(order);
- SearchFunction();
- }
- });
-
- });
Any help would be appreciated!