0

This function call ResizeableTextbox('myRT'); works well inside javascript(produces a resizeable text box) but doesn't work inside jQuery code.Why?

This produces the resizeable textbox.

<script type="text/javascript">
ResizeableTextbox('myRT');
</script>

But if I give it like this in the jquery code,I dont get the resizeable textbox.

$(".select").change(function () {          
       $(".select"+increment+" option:selected").each(function ()    
       {              
         if($(this).text() =='String')
         {
           $("<label id=labelid >"+label+"</label>").appendTo(".menu li");    
           ResizeableTextbox('myRT');//this does not work.How else to code?
         }
       });
 });

Is there any method for function call in jQuery?

Update:

The function call ResizeableTextbox('myRT'); doesn't work anywhere within the jQuery code. It works only inside <script>.

How else to write this function call? some one help me please..

2 Answers 2

2

You want to append the resizable textbox to .menu li? You could do this:

var rt = new ResizeableTextbox('myRT'); //this is for making resizeable text box
$('.menu li').append(rt);

However Im not quite sure if this is what you wan't. Your question is rather vague.

Sign up to request clarification or add additional context in comments.

1 Comment

ya.. you are correct.. I want to append the resizeable text box to .menu li. Previously I just had a text box, $("<input id=inputstr type= 'text' ></input>").appendTo(".menu li"); Now instead of this I need the resizeable text box. If I code what you had said,it throws error.. the page goes blank..
2

It depends greatly on exactly what 'rt' will contain and how it is then added to the DOM.

If it just contains HTML then obviously $(parentSelector).html(rt) would solve the problem. If it returns a DOM element then $(rt).appendTo(parentSelector); If it something else, or is added to the DOM inside your ResizeableTextbox code then I couldn't possibly guess.

Update: If you are using the resizable textbox detailed here: http://www.switchonthecode.com/tutorials/javascript-controls-resizeable-textbox then you would use the following code:

$(document).ready(function() {
  var rt = new ResizeableTextbox();
  $('#resizable').append(rt.GetContainer());
  rt.StartListening();
});

7 Comments

rt is a text box that can be resized.
Yes, but is it a string of HTML, or a DOM element or something else?
@ samjudson I also tried what you have given: var rt=new ResizeableTextbox('myRT'); $(parentSelector).append($(rt.GetContainer())); no result. The page goes blank( says page loading)
The function call ResizeableTextbox('myRT'); doesn't work anywhere within the jQuery code. It works only inside <script>. How else to write this function call?
Err, not sure what you mean. Your jquery code should be in a script.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.