Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-25-2009, 06:21 AM   PM User | #1
vkdixit
New Coder

 
Join Date: Nov 2008
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
vkdixit is an unknown quantity at this point
avoid control overwrite itself jquery

hi all,
I am trying to create runtime controls but when control comes from anothe page. they are overwriting itself...
my code is :


<script src="include/jquery-1.2.6.min.js"></script>
<script type="text/javascript">

$(document).ready(function(){


//phone no.
$("#add_phone").click(function(){

$.post("ajax1.asp",{action:'phonepost',pid:<%=Request("pid")%>},function(msg){

$("#phone_output").html(msg);
$("#phone_output").load("ajax1.asp?pid=<%=Request("pid")%>&action=viewphone");

});

});


});

</script>


and code from the control comes:


<%
if Request("action") ="phonepost" then
per_id=Request("pid")
end if
if Request("action") ="phonepost" or Request("action")="viewphone" then
%>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="80%"><input type="text<%=per_id%>" size="60" value="Enter Phone" name="textfield" onclick="if(this.value=='Enter Phone')this.value='';" onblur="if(this.value=='')this.value='Enter Phone';" /></td>
<td width="17%" align="left"><select id="Phone_relation" name="Phone_relation<%=per_id%>">
<option value="Work" selected="selected">Work</option>
<option value="Mobile">Mobile</option>
<option value="Fax">Fax</option>
<option value="Home">Home</option>
</select></td>
<td width="3%" align="right"><a href="?action=delete&id=<%=per_id%>&pid=<%=per_id%>"><img src="images/remove.gif" style="cursorointer" title="Delete" id="btn_delete" border="0"/></a></td>
</tr>
</table>

<%
response.write "<br>"
end if
%>



plz help....
vkdixit is offline   Reply With Quote
Old 03-25-2009, 06:56 AM   PM User | #2
Eldarrion
Regular Coder

 
Join Date: Feb 2009
Location: Wheeling, IL
Posts: 358
Thanks: 5
Thanked 62 Times in 60 Posts
Eldarrion is on a distinguished road
If I'm reading this correctly... you're losing the 'click' event assigned to $("#add_phone") when the ajax call completes? Mind you, using code tags within your post is a good idea... for instance, you don't get smilies in the middle of the code itself. :P

Anyways... a solution:

Code:
$("#add_phone").live('click', function() {
// Stick what to do upon click here
})
See if that works for you.
__________________
The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

How to ask smart questions?
Eldarrion is offline   Reply With Quote
Old 04-06-2009, 01:49 PM   PM User | #3
vkdixit
New Coder

 
Join Date: Nov 2008
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
vkdixit is an unknown quantity at this point
Quote:
Originally Posted by Eldarrion View Post
If I'm reading this correctly... you're losing the 'click' event assigned to $("#add_phone") when the ajax call completes? Mind you, using code tags within your post is a good idea... for instance, you don't get smilies in the middle of the code itself. :P

Anyways... a solution:

Code:
$("#add_phone").live('click', function() {
// Stick what to do upon click here
})
See if that works for you.
thanks
vkdixit is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:53 PM.


Advertisement
Log in to turn off these ads.