My HTML is a form so someone can write and send a message. they can send the message to any name in my database.
Expand|Select|Wrap|Line Numbers
- <form method="post" name="postMessage" action="">
- <textarea class="input" cols="50" rows="10"></textarea>
- <input type="hidden" name="there_id" id="page_idmessage" value="" />
- <label for="search">Send To:</label>
As the user types in the input text box, the names from the database all apear in a dropdown-box type list. These names appear between the <div id="displaySend">
Expand|Select|Wrap|Line Numbers
- <div id="searchBar">
- <input type="text" class="searchMessageSend" id="searchbox" /><br />
- <div id="displaysend">
- </div>
- </div>
- </div>
looks like this....
Expand|Select|Wrap|Line Numbers
- <div style="position:relative;z-index:100000;">
- <a href="#" class="click" id="24">
- <div class="display_box" id="display_boxSearch">
- <p id="searchName">Luke</p>
- </div>
- </a>
- </div>
And on-click pass the id value ( 24 ) into the value on this input field....
<input type="hidden" name="there_id" id="page_idmessage" value="" />
And also pass the name ( luke ) into the actual input box...
<input type="text" class="searchMessageSend" id="searchbox" />
I have tryed for ages and the best jQuery i could come up with is below, but doesn't seem to work :( ....
Expand|Select|Wrap|Line Numbers
- $(document).ready(function(){
- $("a.click").click(function() {
- var Id = $(this).attr("id");
- var name = $(this).children(text);
- $("#page_idmessage").val(Id);
- $("#searchbox").val(name);
- });
- });