views:

32

answers:

0

Hi ,

I have a textbox over accordion header , now if i type space into the textbox my accordion get collapsed if it is open. so prevent that i have written following code

  $(".edit").click(function(event) {

// if default text is present then select the whole content
  if ($(this).attr('default') == $(this).val()) 
         this.select(); 
        event.stopPropagation();

 });

Now the problem is when i dobule click then whole content written inside textbox is not selected (Which is a default functionality of a textbox)

so to over come i have written following code

$(".edit").dblclick(function(event) {
    this.select();
 });

but now again if i double click then whole text is getting selected but if i single click then the text inside textbox remain selected only it doesn't behave normally.