181
rated 0 times
[
185]
[
4]
/ answers: 1 / hits: 20664
/ 11 Years ago, mon, september 23, 2013, 12:00:00
I am making a plugin for form validation as practice, but for some reason after I create a h2 element and try to set it's attribute, it is not working. Here is the code
var testing = function(regex, value, error_msg, error_msg_field_id){
var pattern = new RegExp(regex);
if (!pattern.test(value)){
var ele = document.createElement(H2);
var node = document.createTextNode(error_msg);
ele.setAttribute('style', 'color:white');
alert(hi);
jQuery(error_msg_field_id).append(node);
}
}
the text appears with no problem, but it is not in white color. This make no sense at all to me
More From » jquery