Search code examples
jquerycustom-tag

Get a custom tag (containing colon) value using jquery


I have one custom tag. I want to set value to that custom tag using jquery. Though it look a silly question i spent more time in searching result for that.

My tag is

<error:description code="12345" type="error" result="description" />${description}

Now i want the get that tag and have to pass the values using jquery.

Please help me how to do this.

I have no things i tried area because i not even know how to start.

Thanks in advance


Solution

  • You need to escape the colon using two back-slashes, so just do

    $('error\\:description').attr("result"); //to get result attribute
    $('error\\:description').text(); //to get the related text