1

I'm adding multiple DIVs via jQuery with an onClick() event. But function rTxt(mndt){ doesn't seem to be working. Can someone hep to fix this?

var tDV = 0;
$("#aTx").click(function() {
    var diagonalScl;
    var txSiz;
    tDV++
    $('#ltn').append('<div id="aTextDV"+tDV class="ui-widget-content"></div>');
    $('#aTextDV'+tDV).append('<div class="txrsPos" id="rzTx" onclick="rTxt(this)"><img src="img/markers/welcome.png"/></div>');
    $("#aTextDV"+tDV).append('<textarea rows="3" id="aText">Your Name</textarea>');

    function rTxt(mndt){
    $("#"+mndt).resizable({
        alsoResize: '#aText'
        ,
        create: function(event, ui) {
            diagonalScl = diagonalSwItms();
            txSiz = parseInt($("#aText").css("font-size"));
        },
        resize: function(e, ui) {
            var diagonalSclNw = diagonalSwItms();
            var ratio = diagonalSclNw / diagonalScl;            
            $("#aText").css("font-size", txSiz + ratio * 10);
        }
    });
});

1 Answer 1

1

try this:

onclick="rTxt(this.id)"

you are passing the Element object to function instead of its id

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

2 Comments

Nope! that did not solve the issue. The SRc is not working either. Also do you see something wrong with the closing of function rTxt(mndt){ ?
probably you are missing the closing brace } of your rTxt function

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.