user3000457
user3000457

Reputation:

html attribute of JQuery not working

I am adding dynamic tags based on a drop down selection; but .html adds my tags as text not real html; here is my code; am I doing something wrong:

$("#trigger_type").change(function() {

    var my_html = "";
    var trigger = $("#trigger_type").val();

    if (trigger == "hybrid") {
        my_html = my_html + "<div class='form-group'> < label for = 'expires_on'> Expires On </label>< input type = 'text' class = 'form-control' id = 'expires_on' placeholder = 'DD-MM-YYYY'> < input type = 'radio' name = 'expires_never' value = 'never' > Never < br >< /div>";
    }
    $("#my_div").html(my_html);

});

If you need more clarification please let me know!

Upvotes: 0

Views: 31

Answers (1)

James Montagne
James Montagne

Reputation: 78650

Remove the spaces after your <s.

< label ...

should be

<label ...

http://jsfiddle.net/bH38G/

Upvotes: 3

Related Questions