Javascript for jquery

This function calls ResizeableTextbox ('myRT'); works well inside javascript (creates a resizable textbox), but doesn't work inside jQuery code. Why?

This creates a resizable text box.

<script type="text/javascript">


ResizeableTextbox ('Myrtle');
</script>

But if I give it like in jquery code, I don't get a resizable 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 calling a function in jQuery?

Update:

Function call ResizeableTextbox ('myRT'); doesn't work anywhere inside jQuery code. It only works internally <script>

.

How else to write this function call? someone helps me ..

+1


a source to share


2 answers


Do you want to add a mutable textbox to .menu li? You can do it:

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

      



However, I'm not entirely sure if this is what you didn't want. Your question is rather vague.

+2


a source


It depends a lot on what exactly "rt" contains and how it gets added to the DOM.

If it just contains HTML then it $(parentSelector).html(rt)

will obviously solve the problem. If it is returning a DOM element, then $(rt).appendTo(parentSelector);

If it is something else or added to the DOM inside your code ResizeableTextbox

, then I couldn't guess.



Update. If you are using a resizable textbox which is described here: http://www.switchonthecode.com/tutorials/javascript-controls-resizeable-textbox you should use the following code:

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

      

+2


a source







All Articles